SheetJS / sheetjs

📗 SheetJS Spreadsheet Data Toolkit -- New home https://git.sheetjs.com/SheetJS/sheetjs
https://sheetjs.com/
Apache License 2.0
35.02k stars 8k forks source link

XLSX.read always read sheetname as sheet1 #2725

Closed consciousnessdev closed 2 years ago

consciousnessdev commented 2 years ago

I have problem when run XLSX.read its always return sheet name as Sheet1, even though the sheet name has been changed to 'data', image

Maybe can help with below clues:

consciousnessdev commented 2 years ago

Solved.

Caused by File Object must Converted to Binary String, then set XLSX.read type to binary

robhoff-laerdal commented 1 year ago

@consciousnessdev How did you convert your file to a binary string? I am having the same issue.

consciousnessdev commented 1 year ago

@consciousnessdev How did you convert your file to a binary string? I am having the same issue. With this Code @robhoff-laerdal

const fileObjectToBinary = fileObj => new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsBinaryString(fileObj);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});

Hope its help you :)