CSV To HTML
March 17, 2020
Today’s exercise is another in my continuing escapades in “stealth programming” using awk. I frequently write programs that produce CSV files as output. Most of the time the output file is loaded into Excel by the user. Sometimes the CSV file must be printed as well as loaded into Excel, and I wrote a program to do that in a previous exercise. I recently had a request to produce the output in HTML format, so I wrote that program yesterday.
Your task is to write a that converts a CSV file to HTML output; use whatever conventions make sense to you. When you are finished, you are welcome to read a suggested solution, or to post your own solution or discuss the exercise in the comments below.
Here’s a solution in Python.
Example Output:
Year
Make
Model
1997
Ford
E350
2000
Mercury
Cougar
In my last comment, I tried pasting the HTML for the table itself, but it does not appear to work. Here’s another attempt, this time with the newlines removed.
YearMakeModel1997FordE3502000MercuryCougar
Great post! I really learned a lot from it.
Racket: https://github.com/xojoc/programming-challenges/blob/master/programming-praxis/2020_03_17.rkt