Skip to content

jeet-dhandha/xlsx-parse-table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@libs-jd/xlsx-parse-table npm version

A library to parse tables from Excel worksheets.

Demo

Link to Demo, where you can upload an Excel file and see the parsed tables.

Install

Install with npm:

$ npm install --save @libs-jb/xlsx-parse-table xlsx

Usage

Works with Excel files.

Example - Node.js

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);

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Sample Files

dummy-with-mer-mec-6-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, "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],
  ],
];

dummy-with-ser-sec-3-out.xlsx

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],
  ],
];

Related projects

You might also be interested in these projects:

  • xlsx: A library to parse and write Excel files. | homepage

Author

Jeet Dhandha

License

Released under the MIT License.