Gathering detailed insights and metrics for node-xlsx
Gathering detailed insights and metrics for node-xlsx
Gathering detailed insights and metrics for node-xlsx
Gathering detailed insights and metrics for node-xlsx
npm install node-xlsx
Typescript
Module System
Min. Node Version
Node Version
NPM Version
89.6
Supply Chain
99
Quality
77
Maintenance
100
Vulnerability
100
License
TypeScript (89.89%)
JavaScript (10.11%)
Total Downloads
36,828,667
Last Day
30,688
Last Week
254,790
Last Month
1,261,594
Last Year
13,335,495
2,995 Stars
171 Commits
275 Forks
31 Watching
1 Branches
21 Contributors
Minified
Minified + Gzipped
Latest Version
0.24.0
Package Id
node-xlsx@0.24.0
Unpacked Size
42.04 kB
Size
8.16 kB
File Count
17
NPM Version
10.5.0
Node Version
20.12.0
Publised On
15 Apr 2024
Cumulative downloads
Total Downloads
Last day
-44.8%
30,688
Compared to previous day
Last week
-16.3%
254,790
Compared to previous week
Last month
3.9%
1,261,594
Compared to previous month
Last year
47.9%
13,335,495
Compared to previous year
Straightforward excel file parser and builder.
1npm install node-xlsx --save 2# or 3pnpm add node-xlsx
1import xlsx from 'node-xlsx'; 2// Or var xlsx = require('node-xlsx').default; 3 4// Parse a buffer 5const workSheetsFromBuffer = xlsx.parse(fs.readFileSync(`${__dirname}/myFile.xlsx`)); 6// Parse a file 7const workSheetsFromFile = xlsx.parse(`${__dirname}/myFile.xlsx`);
1import xlsx from 'node-xlsx'; 2// Or var xlsx = require('node-xlsx').default; 3 4const data = [ 5 [1, 2, 3], 6 [true, false, null, 'sheetjs'], 7 ['foo', 'bar', new Date('2014-02-19T14:30Z'), '0.3'], 8 ['baz', null, 'qux'], 9]; 10var buffer = xlsx.build([{name: 'mySheetName', data: data}]); // Returns a buffer
1import xlsx from 'node-xlsx'; 2// Or var xlsx = require('node-xlsx').default; 3 4const data = [ 5 [1, 2, 3], 6 [true, false, null, 'sheetjs'], 7 ['foo', 'bar', new Date('2014-02-19T14:30Z'), '0.3'], 8 ['baz', null, 'qux'], 9]; 10const sheetOptions = {'!cols': [{wch: 6}, {wch: 7}, {wch: 10}, {wch: 20}]}; 11 12var buffer = xlsx.build([{name: 'mySheetName', data: data}], {sheetOptions}); // Returns a buffer
A1:A4
in every sheets1import xlsx from 'node-xlsx'; 2// Or var xlsx = require('node-xlsx').default; 3 4const data = [ 5 [1, 2, 3], 6 [true, false, null, 'sheetjs'], 7 ['foo', 'bar', new Date('2014-02-19T14:30Z'), '0.3'], 8 ['baz', null, 'qux'], 9]; 10const range = {s: {c: 0, r: 0}, e: {c: 0, r: 3}}; // A1:A4 11const sheetOptions = {'!merges': [range]}; 12 13var buffer = xlsx.build([{name: 'mySheetName', data: data}], {sheetOptions}); // Returns a buffer
A1:A4
in second sheet1import xlsx from 'node-xlsx'; 2// Or var xlsx = require('node-xlsx').default; 3 4const dataSheet1 = [ 5 [1, 2, 3], 6 [true, false, null, 'sheetjs'], 7 ['foo', 'bar', new Date('2014-02-19T14:30Z'), '0.3'], 8 ['baz', null, 'qux'], 9]; 10const dataSheet2 = [ 11 [4, 5, 6], 12 [7, 8, 9, 10], 13 [11, 12, 13, 14], 14 ['baz', null, 'qux'], 15]; 16const range = {s: {c: 0, r: 0}, e: {c: 0, r: 3}}; // A1:A4 17const sheetOptions = {'!merges': [range]}; 18 19var buffer = xlsx.build([ 20 {name: 'myFirstSheet', data: dataSheet1}, 21 {name: 'mySecondSheet', data: dataSheet2, options: sheetOptions}, 22]); // Returns a buffer
Beware that if you try to merge several times the same cell, your xlsx file will be seen as corrupted.
Examples:
1const rowAverage = [[{t: 'n', z: 10, f: '=AVERAGE(2:2)'}], [1, 2, 3]]; 2var buffer = xlsx.build([{name: 'Average Formula', data: rowAverage}]);
Refer to xlsx documentation for valid structure and values:
This library requires at least node.js v10. For legacy versions, you can use this workaround before using the lib.
1npm i --save object-assign
1Object.prototype.assign = require('object-assign');
Please submit all pull requests the against master branch. If your unit test contains javascript patches or features, you should include relevant unit tests. Thanks!
Script | Description |
---|---|
start | Alias of test:watch |
test | Run mocha unit tests |
test:watch | Run and watch mocha unit tests |
lint | Run eslint static tests |
compile | Compile the library |
compile:watch | Compile and watch the library |
Olivier Louvignes
Copyright (C) 2012-2014 Olivier Louvignes
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Except where noted, this license applies to any and all software programs and associated documentation files created by the Original Author and distributed with the Software:
Inspired by SheetJS gist examples, Copyright (c) SheetJS.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
Found 4/30 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More