I have been using PapaParse to convert .csv files to JSON. PapaParse returns the .csv file as an array of objects.
There have been many answers here (such as this elegant one: display array of objects in a dynamic table javascript) about how to take an array of objects and make it into a table if you know the structure, but I would like to be able to make a generic parser, since I have a number of .csv files to convert, which will automatically fill in the information and size the table, (just as "console.table" does.)
I can see how to retrieve the data for the header, but is there a way to avoid having to know the key names for each column, since they will always be different for each .csv file? e.g. "Location" and "Year" here:
td.innerHTML = jsData[i].Location;
td = tr.insertCell(tr.cells.length);
td.innerHTML = jsData[i].Year;
td = tr.insertCell(tr.cells.length); etc.
Thanks!