I have been working on an interactive, static web application project at work, and I've completed everything I want, with a few tiny last hurdles. I've written everything in HTML, CSS and JS with no frameworks. Everything runs smoothly client-side, and I even put it on Github Pages and it works well there too. The issue is this: currently, I have some data hard-coded into a String in the JS file, and I would rather the JS reference some kind of excel sheet (.csv, .xlxs or Google sheet) or text file with the data.
I know that this violates security policies when the user does not directly select the file (via input
), so I was thinking about using Google Sites (which, if I'm not mistaken, can reference an embedded Google Sheet?). However, I'm fairly certain that this doesn't give me the freedom of using everything that I want to (i.e. images, custom fonts, as well as css and js).
All of the code is in this repo, but I don't think that showing code is helpful to what I'm asking.
I guess the real question is, we want the program to be continuable for the future, and that people other than me (who don't necessarily know how the code works) can update the data. Bottom line, we don't want that data hard-coded, and we need a solution that encompasses everything in the directory.
Side note, I would like to try to stay away from servers and databases, but if that might be my only solution, then I guess I have no choice.
Security policies are only an issue if your web application is being ran over file:// protocol - so long as you have any kind of minimal web server (app being static makes this easier) to run it, or host the app on GitHub pages, you'll be able to pull your data files from relative paths via Ajax.
Using CSV is probably the most straightforward choice here - virtually every sheet-related application can import/export the format, and the overhead to parse it on JS side is minimal.