I have a csv (file.csv) file which will for the most part be opened using excel, and I want it to act as a data source for an html file. I want to play with the data using vanilla javascript.
The end result I want is as follows:
I want the html file itself to be like a finished good. I don't want the user (generally me) to have to do anything to get data in or anything like that.
Some thing I have considered:
Option 1:
Ajax is not an option because the cors policy will not allow it. Both files are living on the desktop and that is where they have to stay.
Option 2:
An html form or drag/drop functionality using fileReader are not options. I can already do this and the result is not what I want.
Option 3:
Instead of keeping my file as file.csv, I could save it as file.xlsm (a macro-enabled workbook) and write a subroutine in excel-VBA to run when the workbook is closed which would rewrite the html file, updating it with the new data. In this way, there is no real linking; the data would basically be hard-coded into the html file, and overwritten whenever changes are made to the .xlsm file.
Option 4:
I can use a script tag to link to the csv file like so:
src="file:///C:/Users/Username/Desktop/file.csv"
I can see the content of the file in sources, but I don't know how to get it out of there.
Option 5:
I haven't tried using excel-VBA to take my csv file and spit out a json file. I could link to it like in Option 4, and I would know how to access the data.