modified from https://github.com/dbohdan/csv2html