When - as suggested - you produce correct (and valid) CSV *), there are utilities available that can convert CSV to XLS or HTML.
e.g. Spreadsheet::Read comes with xlscat that offers the -H option.
$ cat test.csv header,line,1 a,34,12 b,42, c, ,mars $ xlscat -H test.csv >test.html 3 x 4 $
The HTML includes a valid header with CSS, so you can alter the output appearance (with alternating even/odd line coloring)
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/T +R/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>test.csv</title> <meta name="Author" content="xlscat 2.1" /> <style type="text/css"><!-- body, h2, td, th { font-family: "Nimbus Sans L", "DejaVu Sans", Helvetica, Arial, sans; } table { border-spacing: 2px; border-collapse: collapse; } td, th { vertical-align: top; padding: 4px; } table > tbody > tr > th, table > tr > th { background: #e0e0e0; } table > tbody > tr > td:not([class]), table > tr > td:not([class]) { background: #f0f0f0; } .odd { background: #e0e0e0; } --></style> </head>
| header | line | 1 |
| a | 34 | 12 |
| b | 42 | |
| c | mars |
*) Producing valid CSV with Text::CSV_XS or Text::CSV is easy, use print as demonstrated in this example.
In reply to Re: CSV or HTML?
by Tux
in thread CSV or HTML?
by jms53
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |