Skip to content

Commit

Permalink
[excel-insert-file] Fix JSON data import (#593)
Browse files Browse the repository at this point in the history
* Fixing JSON variable scope

* Remove temp files
  • Loading branch information
AlexJerabek authored Sep 8, 2023
1 parent 2e39e3a commit d27533a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Samples/excel-insert-file/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ async function insertSheets() {
const sheet = context.workbook.worksheets.getItem("Template");

// Get data from your REST API. For this sample, the JSON is fetched from a file in the repo.
let json;
let response = await fetch(dataSourceUrl + "/data.json");
if (response.ok) {
const json = await response.json();
json = await response.json();
} else {
console.error("HTTP-Error: " + response.status);
return;
}

// Map JSON to table columns.
Expand Down

0 comments on commit d27533a

Please sign in to comment.