Skip to content

Excel parser in JavaScript that allows you to read and parse data from Excel files. The parser uses a third-party library called xlsx to handle the Excel file processing.

Notifications You must be signed in to change notification settings

rravula22/excel_parser_javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Excel Parser in JavaScript

This is a simple Excel parser in JavaScript that allows you to read and parse data from Excel files. The parser uses a third-party library called xlsx to handle the Excel file processing.

Installation

To use the Excel parser, you'll need to install the required dependencies using npm or yarn.

npm install xlsx

Usage

  1. Import the xlsx library in your JavaScript file:
const XLSX = require('xlsx');
  1. Load the Excel file:
const workbook = XLSX.readFile('path/to/your/excel-file.xlsx');
  1. Get the sheet name:
const sheetName = workbook.SheetNames[0]; // Assuming the first sheet in the Excel file
  1. Access the sheet data:
const worksheet = workbook.Sheets[sheetName];
  1. Parse the data:
const parsedData = XLSX.utils.sheet_to_json(worksheet, { header: 1 });

Now, parsedData will contain the Excel data in a two-dimensional array. Each row of the Excel file will be an array element, and each cell's value will be an element within the row array.

Example:

const data = [
  ['Name', 'Age', 'Email'],
  ['John', 30, 'john@example.com'],
  ['Alice', 25, 'alice@example.com'],
  ['Bob', 28, 'bob@example.com'],
];

You can access the data and perform any further processing as needed.

Excel File Format

The parser supports various Excel file formats, including .xlsx, .xlsb, .xlsm, .xls, .ods, .fods, and .csv.

License

This project is licensed under the MIT License. You are free to use, modify, and distribute it as per the terms of the license.

Acknowledgments

The Excel parser utilizes the xlsx library by SheetJS. Thanks to the SheetJS team for their great work!

For more detailed information and options regarding the xlsx library, please refer to the official SheetJS documentation.

About

Excel parser in JavaScript that allows you to read and parse data from Excel files. The parser uses a third-party library called xlsx to handle the Excel file processing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published