<?php
-# This file generates what Excell refers to as "CSV" files. This format makes
-# little sense, and does not actually have anything to do with commas.
+# These functions redutrn a csv download which is hopefully easy to import into
+# Excell and LibreOffice Calc
# pass in a 2d array (array of rows) and it'll send it to the browser
# I can't figure out how to get multi-line fields to work, so this replaces newlines with 4 spaces.
if($first) {
$first = false;
} else {
- echo "\t";
+ echo ",";
}
echo '"' . str_replace("\n", " ", str_replace('"', '""', $el)) . '"';
}