Socket
Socket
Sign inDemoInstall

node-xlsx

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-xlsx

NodeJS Excel files parser & builder


Version published
Weekly downloads
268K
decreased by-1.55%
Maintainers
1
Weekly downloads
 
Created

What is node-xlsx?

The node-xlsx package is a powerful tool for parsing and writing Excel files in Node.js. It allows you to read data from Excel files, manipulate it, and write it back to new Excel files. This package supports both .xlsx and .xls formats.

What are node-xlsx's main functionalities?

Reading Excel Files

This feature allows you to read data from an Excel file. The `parse` method reads the file and returns an array of worksheets, each containing an array of rows and columns.

const xlsx = require('node-xlsx');
const workSheetsFromFile = xlsx.parse(`${__dirname}/myFile.xlsx`);
console.log(workSheetsFromFile);

Writing Excel Files

This feature allows you to write data to an Excel file. The `build` method creates a buffer from the data, which can then be written to a file using Node's `fs` module.

const xlsx = require('node-xlsx');
const data = [[1, 2, 3], [4, 5, 6]];
const buffer = xlsx.build([{name: 'mySheetName', data: data}]);
require('fs').writeFileSync('myFile.xlsx', buffer);

Manipulating Excel Data

This feature allows you to manipulate data within an Excel file. You can read the file, modify the data, and then write the updated data back to a new file.

const xlsx = require('node-xlsx');
const workSheetsFromFile = xlsx.parse(`${__dirname}/myFile.xlsx`);
workSheetsFromFile[0].data[0][0] = 'New Value';
const buffer = xlsx.build(workSheetsFromFile);
require('fs').writeFileSync('myFile.xlsx', buffer);

Other packages similar to node-xlsx

Keywords

FAQs

Package last updated on 18 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc