How can i make local file I/O with Microsoft Office JavaScript API using Script Lab?

Viewed 394

I am trying to read/write data from/to local files with Microsoft Office Javascript API using Script Lab to my Excel snippet. Still did not find any proper way to do it. Have tried this solution:

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) {
        var allText = rawFile.responseText;
        console.log(allText);
      }
    }
  };
  rawFile.send(null);
}

However when the function runs it comes up with an error like this: Network Error DOM Exception

▶["NetworkError", "https://script-lab-runner.azureedge.net/", 226, 5, DOMException]
 0: "NetworkError"

 1: "https://script-lab-runner.azureedge.net/"

 2: 226

 3: 5

 4: DOMException

Is it possible to read/write file with Microsoft Office Javascript API using Script Lab? Thanks!

0 Answers
Related