Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Zaedus/excel-to-rows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

excel-to-rows

Parses a spreadsheet and returns the rows as objects.

Examples

Read from a file

const excelToRows = require('excel-to-rows');

// Read as .xlsx file
excelToRows.fromXlsx("/path/to/file.xlsx");

// Read as .csv file
excelToRows.fromCsv("/path/to/file.csv");

// Read as automatically determined file type
excelToRows.from("/path/to/file");

Read from a stream

const excelToRows = require('excel-to-rows');
const fs = require('fs');

// Read as .xlsx file
excelToRow.fromXlsx(fs.createReadStream("/path/to/file.xlsx"));

// Read as .csv file
excelToRow.fromXlsx(fs.createReadStream("/path/to/file.csv"));

Example

data.xlsx

ID First Name Last Name Job
0 Albert Einstein Theoretical Physicist
1 Jeff Delaney JS Developer
2 Jeff Bezos CEO of Amazon

index.js

const excelToRows = require('excel-to-rows');

(async function() {
    console.log(await excelToRows.from("./data.xlsx"));
}())

Output:

[
  {
    ID: 0,
    'First Name': 'Albert',
    'Last Name': 'Einstein',
    Job: 'Theoretical Physicist'
  },
  {
    ID: 1,
    'First Name': 'Jeff',
    'Last Name': 'Delaney',
    Job: 'JS Developer'
  },
  {
    ID: 2,
    'First Name': 'Jeff',
    'Last Name': 'Bezos',
    Job: 'CEO of Amazon'
  }
]

About

Parses a spreadsheet and returns the rows as objects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published