This commit is contained in:
SheetJS 2023-02-07 21:12:21 -05:00
parent a93a691ee0
commit 4af5b52bca

@ -100,6 +100,35 @@ server with NodeJS or some other server-side technology.
If the files are small, please [report to our issue tracker](https://git.sheetjs.com/sheetjs/sheetjs/issues)
#### Invalid HTML: could not find table
Data can be fetched and parsed by the library:
```js
const response = await fetch("test.xlsx");
const wb = XLSX.read(await response.arrayBuffer());
```
If the file does not exist, servers will send a 404 response that may include a
friendly HTML page. Without checking the response code, the integration will try
to read the 404 page and fail since the HTML typically has no TABLE elements.
When building a project with CRA or other templates, spreadsheets must be placed
in the `public` folder. That folder is served by the dev server and copied in
the build process.
Integration code should defend against network issues by checking status code.
For example, when using `fetch`:
```js
async function fetch_workbook_and_error_on_404(url) {
const response = await fetch(url);
if(res.status == 404) throw new Error("404 File Not Found");
const ab = await response.arrayBuffer();
return XLSX.read(ab);
}
```
#### SCRIPT5022: DataCloneError
IE10 does not properly support `Transferable`.