Can you show the data of an excel-fle (or csv) in a webpage | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can you show the data of an excel-fle (or csv) in a webpage

I have some data in a csv-file. I need to represent this data in a nice way to non technical people. I can do this in excel and use macro's and VBA But this thought came in to my mind. Can I read the data from these files and show it in a webpage. It does not need to be on the internet, all files are local. What would I need if I wanted to do this

4th Jan 2019, 7:41 PM
sneeze
sneeze - avatar
2 Answers
+ 3
You could use d3 to get content of a csv file to an object. Use cors helper url to get rid of cors if the location of csv file is not the same domain as html file. You don't need corsUrl for local file access. var corsUrl = 'https://cors-anywhere.herokuapp.com/'; d3.csv(corsUrl + csvFile, function(data){ console.log(data); }); Note that it requires that the first line of the CSV file contains a comma-separated list of column names; these column names become the attributes on the returned objects. For example, consider the following CSV file: Year,Make,Model,Length 1997,Ford,E350,2.34 2000,Mercury,Cougar,2.38 Reference: https://d3-wiki.readthedocs.io/zh_CN/master/CSV/ https://code.sololearn.com/Wwb3QtwCmvdX/?ref=app
4th Jan 2019, 10:25 PM
Calviղ
Calviղ - avatar
+ 2
Thank you. I will try.
5th Jan 2019, 3:57 PM
sneeze
sneeze - avatar