# usage: perl csv2html.pl < input.csv [ > output.html ] # 1. Save the HE spreadsheet as CSV. # # 2. Strip any header rows out of the csv file, # The script only converts the table cell lines. # # 3. The script cannot handle correctly the case where # a delimiter is part of a cell. # e.g.: 1,fruit,"apples, oranges, bananas" # Here 5 cells are created instead of only 3. $DELIM= ','; #define the cell delimiter print "\n"; while (<>) { print " \n"; my @fields = split($DELIM); for $cell(@fields) { $cell =~ tr/\r\n//d; #delete CRLF at end of line $cell = " \n"; $cell =~ s???g; print $cell; } print " \n"; } print "
" . $cell . " \;
\n";