I am trying to fill an array from an Excelsheet. I have tried many attempts but in an other post I had a partial answer.
CSV is a format more portable than XLS which can be exported from excel. This format is easy to be parsed (try to export a CSV file from XLS in excel and open it with a text editor by yourself!). If this change in format is acceptable, the problem can be simplified quite a lot.
I made .csv and also a .txt folder on my desktop but I am not able to read it. I have tried many html/js code and I have encountered this answer from the console.
testexcel.html:43 Access to XMLHttpRequest at 'file:///C:/exceltest2.1.txt' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
or with fetch the same
Fetch API cannot load file:///C:/Users/ubi11/Desktop/exceltest2.1.txt. URL scheme must be "http" or "https" for CORS request. getData @ testexcel.html:15 (anonymous) @ testexcel.html:12
I tried to put my file in google drive then:
Access to fetch at 'https://drive.google.com/file/d/1XxRJeH2yOyAmatnhj-zF2CsGz1R3WzQk/view?usp=sharing' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
What is CORS policy? is there a way to read a file and parse what is inside? if there is no solution, can I do what I need through GoogleSheet or will I have the same problem?
I actually need to do something easy, read a list of numbers in 4 columns. I don't want to put this list neither in the js code nor in an sql database.
TY