I am trying to load data from a local CSV file into into my Excel add in, in order to populate a worksheet with the data from said CSV file. Here is the current code that I have...
function readTextFile(file) {
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function () {
if (rawFile.readyState === 4) {
if (rawFile.status === 200 || rawFile.status == 0) {
return rawFile.responseText;
}
}
}
rawFile.send(null);
}
When this code is called, I receive an "Access in denied" error in the rawFile.Open("GET...
line. How do I fix this?
The file
parameter passed in is:
"file:///C:/path/to/file/data.csv"