eligrey / eligrey/FileSaver.js

CSV export resulting in error for .xlsx

Open
#627 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
22k
Forks
4.3k
PR merge metrics
No merged PRs in 30d

Description

Getting the following error when trying to use `.xlsx` extension.

> Excel cannot open the file 'ManageRides (1).xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.

I am using the following code: (commented ones are also being tried)
`exportCSV={{
fileName: 'filename.xlsx',
blobType: "data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"
//blobType: "data:text/csv;charset=utf-8"
//blobType: "data:text/csv;charset=UTF-8,%EF%BB%BFs"
}}`

**Screenshots**
![image](https://user-images.githubusercontent.com/8638426/74140877-ec451600-4c1b-11ea-8034-e44d1f544e7a.png)

On using the `.xls` extension, whole row data is shown in the first cell and no column segregation happens.

![image](https://user-images.githubusercontent.com/8638426/74141104-51007080-4c1c-11ea-810f-2987bef6b9a5.png)
![image](https://user-images.githubusercontent.com/8638426/74141176-73928980-4c1c-11ea-98ab-3fc070a39e38.png)

Whats `blobType` is supported for `.xls` or `.xlsx` extension?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.