aobajsxl
v1.0.3
Published
A TypeScript library to transform JSON to XLSX files.
Maintainers
Readme
AobaJSXL
AobaJSXL is a TypeScript library designed to parse, manipulate, and generate Excel .xlsx files. It provides a robust API to transform JSON data into Excel files and vice versa, leveraging the power of JSZip for ZIP file handling and OpenXML standards for Excel file structure.
Features
- JSON to Excel Transformation: Easily convert JSON data into
.xlsxfiles. - Excel Parsing: Extract and process data from existing
.xlsxfiles. - Sheet Management: Add, update, and retrieve data from worksheets.
- Shared Strings Support: Efficiently handle shared strings for text reuse in Excel files.
- Lightweight and Fast: Built on top of JSZip for efficient ZIP file handling.
Installation
Install AobaJSXL via npm or yarn:
npm install aobajsxlor
yarn add aobajsxlUsage
Importing the Library
The Excel class is the main entry point for interfacing with the library. It provides methods to parse and generate Excel files.
import { Excel } from 'aobajsxl';Parsing an Excel file
import { Excel } from 'aobajsxl';
const excel = new Excel();
// Load an Excel file
await excel.read('example.xlsx');
// Access sheet data
const sheetData = excel.getData('Sheet1');
console.log(sheetData);Generating an Excel file
import { Excel } from 'aobajsxl';
const excel = new Excel();
// Add data to a sheet
excel.setData('Sheet1', [
{ Name: 'Alice', Age: 25 },
{ Name: 'Bob', Age: 30 },
]);
// Generate the Excel file
await excel.write('example.xlsx');API Reference
API Document - Excel
Project Structure
src/
├── base/
│ ├── excel-core.ts # Core functionality for handling Excel components
│ ├── excel-data-handler.ts # Internal class for parsing and generating Excel files
├── index.ts # Entry point exposing the Excel classDevelopment
Prerequisties
- Node.js (v14 or higher)
- npm or yarn
Setup
- Clone the repository:
git clone https://github.com/jchirayil/aobajsxl.git
cd aobajsxl- Install dependencies:
npm installBuild
To build the library
npm run buildRun Tests
To run the test suite:
npm testContributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push the branch.
- Open a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgement
- JSZip for Zip file handling.
- OpenXML standards for Excel file structure.
Contact
For questions or support, please open an issue on the GitHub repository.
