exceljs: [BUG] readFile error
readFile gives TypeError: Cannot read property 'F_OK' of undefined
I have
import { Workbook } from "exceljs";
let workbook = new Workbook();
files.forEach((file) => {
const data = workbook.csv.readFile(file.name)
})
Tried with workbook.xlsx.readFile and this gives same error.
I have version 3.8.1 installed.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 21 (4 by maintainers)
Exceljs v4.1.0 :
import { Workbook } from 'exceljs/excel'fix the problem with Electron.I’m using from an Electron window with nodeIntegration: true and still getting this.
I’m able to use other libraries that access the file system (and even fs itself), but I can’t get around this error with exceljs.
Workaround if using this in electron
Hello guys, this
exceljsuses different modules in the browser and node environment, you can refer to the following code.Demo
Related to issue #1213 .
If you works on browser environment,
fsdoesn’t exist.fsexist only on nodejs environment. If you works with Electron, be sure to import exceljs like this :import { Workbook } from 'exceljs/excel'