Skip to content
Advertisement

display csv file inside a table using javascript

I have this script that gets the csv file, and separates it by column. I am having trouble to display the values in a table. I can’t seem to get each column to create a new table row. Any help will be appreciated as I am not very good at JS.

JavaScript

The data.csv looks something like this:

JavaScript

The console.log(data, temp) returns without the commas. My only problem is trying to get them inside a table using Javascript.

JavaScript

Advertisement

Answer

JavaScript
JavaScript

Try this and let me know if its working or not. Please note i’ve added an ID to the table body and selecting that via ID.

Advertisement