Use biterscripting to generate HTML table from a CSV file.
Let's say the following.
QUOTE
- You have data in a CSV file at C:/Temp/X.csv.
- You want to create an html page at C:/Temp/Y.html .
Fair enough. Here is a quick script.
CODE
set $wsep = ","
# Read .csv data into a variable.
var str input; cat "C:/Temp/X.csv" > $input
# Create table header.
var str output; echo "<table width=200>" >> $output
# Read rows one by one
while ($input <> "")
do
var str row; lex -e "1" $input > $row
# Write row header
echo "<tr>" >> $output
# Read columns one by one
while ( $row <> "")
do
# Write next column header, column data, column footer.
var str column; wex -e "1" $row > $column
echo ("<td>"+$column+"</td>\n") >> $output
done # done processing columns
# Write row footer
echo "</tr>\n\n" >> $output
done # done processing rows
# Write table footer.
echo "</table>" >> $output
# HTML table is in $output. Write to file with <html> and </html>.
echo ("<html>\n"+$output+"</html>") > "C:/Temp/Y.html"
I recommend you take a look at biterscripting. It installs very quickly. Follow instructions at
http://www.biterscripting.com/install.html . It is free.
Take care.
Richard