Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 90224

Loading data from local file into Excel Add In

$
0
0

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"


Viewing all articles
Browse latest Browse all 90224

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>