Skip to content

CSV export resulting in error for .xlsx #1249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
g-akshay opened this issue Feb 10, 2020 · 3 comments
Closed

CSV export resulting in error for .xlsx #1249

g-akshay opened this issue Feb 10, 2020 · 3 comments
Assignees

Comments

@g-akshay
Copy link

g-akshay commented Feb 10, 2020

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

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

image
image

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

@AllenFang
Copy link
Member

AllenFang commented Feb 11, 2020

actually, I'm not sure about this answer, we used file-saver to save file and they just provide a way to customize the blob type. I think you have to ask this question in their repository https://github.com/eligrey/FileSaver.js/ .

You can open another issue if they or you still think this issue is about react-bootstrap-table2

@malsioufi
Copy link

@g-akshay I have the same issue. How did you solve it?

@fjperini
Copy link

@g-akshay @malsioufi I have applied some changes in react-bootstrap-table2-toolkit to export in xlsx, it works perfectly. I hope it will be of help to those who need to use the format #1666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants