using xlsx lib instead of exceljs, export excel files

This commit is contained in:
Jan Prochazka
2020-11-19 10:30:06 +01:00
parent 6324fd1de4
commit da805db44b
9 changed files with 192 additions and 412 deletions

View File

@@ -1,4 +1,4 @@
const exceljs = require('exceljs');
const xlsx = require('xlsx');
const _ = require('lodash');
module.exports = {
@@ -6,14 +6,7 @@ module.exports = {
analyseExcel_meta: 'get',
async analyseExcel({ filePath }) {
const workbook = new exceljs.Workbook();
await workbook.xlsx.readFile(filePath);
return {
tables: workbook.worksheets.map((sheet) => {
const header = sheet.getRow(1);
const columns = _.range(header.cellCount).map((index) => ({ columnName: header.getCell(index + 1).value }));
return { pureName: sheet.name, columns };
}),
};
const workbook = xlsx.readFile(filePath, { bookSheets: true });
return workbook.SheetNames;
},
};