A library to parse tables from Excel worksheets.
Link to Demo, where you can upload an Excel file and see the parsed tables.
Install with npm:
$ npm install --save @libs-jb/xlsx-parse-table xlsx
Works with Excel files.
const xlsx = require("xlsx");
const workbook = xlsx.readFile("path/to/excel-file.xlsx");
const worksheet = workbook.Sheets[workbook.SheetNames[0]];
const { parse } = require("@libs-jb/xlsx-parse-table");
const tables = parse(worksheet);
console.log(tables);
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Output
[
[
["Sr. No.", "Email", "Name ", "Age", "Promoted", "ID", "Joining Date", "Termination Date"],
[1, "jeet@gmail.com", "Jeet D.", 26, "", "EM1", 45353, 45537],
[2, "john@gmail.com", "John D.", 25, "", "EM2", 45373, 45732],
[3, "adi@gmail.com", "Adi. D.", 25, "", "EM3", 45598, 45607],
],
[
["Sr. No.", "EM ID", "Salary"],
[1, "EM1", 1000000],
[2, "EM2", 1200000],
],
[
["Sr. No.", "EM ID", "Salary"],
[1, "EM1", 1000000],
[2, "EM2", 1200000],
[3, "EM3", 1400000],
],
[
["Sr. No.", "EM ID", "Salary"],
[1, "EM1", 1000000],
[2, "EM2", 1200000],
],
[
["Sr. No.", "EM ID", "Salary"],
[1, "EM1", 1000000],
[2, "EM2", 1200000],
],
[
["Sr. No.", "EM ID", "Salary"],
[1, "EM1", 1000000],
[2, "EM2", 1200000],
[3, "EM3", 1400000],
],
];
dummy-with-ser-noec-2-out.xlsx
Output
[
[
["Sr. No.", "Email", "Name ", "Age", "Promoted", "ID", "Joining Date", "Termination Date"],
[1, "jeet@gmail.com", "Jeet D.", 26, "", "EM1", 45353, 45537],
[2, "jogn@gmail.com", "John D.", 25, "", "EM2", 45373, 45732],
[3, "adi@gmail.com", "Adi. D.", 25, "", "EM3", 45598, 45607],
],
[
["Sr. No.", "EM ID", "Salary"],
[1, "EM1", 1000000],
[2, "EM2", 1200000],
[3, "EM3", 1400000],
],
];
Output
[
[
["Email", "Name ", "Age"],
["jeet@gmail.com", "Jeet D.", 26],
["john@gmail.com", "John D.", 25],
["adi@gmail.com", "Adi. D.", 25],
],
[
["Sr. No.", "ID", "Joining Date", "Termination Date"],
[1, "EM1", 45353, 45537],
[2, "EM2", 45373, 45732],
[3, "EM3", 45598, 45607],
],
[
["Sr. No.", "EM ID", "Salary"],
[1, "EM1", 1000000],
[2, "EM2", 1200000],
[3, "EM3", 1400000],
],
];
You might also be interested in these projects:
Jeet Dhandha
Released under the MIT License.