GithubHelp home page GithubHelp logo

zurmokeeper / other-excel Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 727 KB

otherExcelJS is a library for working with excel. including xls reading and writing.

Home Page: https://www.npmjs.com/package/other-excel

License: MIT License

TypeScript 88.37% JavaScript 11.63%
cfb jest office oled ts typescript xls xlsx otherexceljs

other-excel's Introduction

other-excel

other-excel is a library for working with excel. including xls reading and writing.

PS:Exporting xls is not supported yet

Special Notes

Inspired by xlsx, some of the source code was copied directly from xlsx

The reason for all the rewrites is that the community version of xlsx is not going to be updated anymore, and also the API for xlsx is really unfriendly and costly to use, as well as the readability of the source code is not good. So use TS to rewrite it, and the API is designed and returned more friendly.

Contents

Install

npm/yarn/pnpm install other-excel

Examples


use commonjs:

const OtherExcel = require('other-excel').default;

//decrypt a file with a password
(async ()=>{
        const otherExcel = new OtherExcel();
        const workbook = await otherExcel.read('./test.xls');

        Get sheetNames:
        workbook.sheetNames -> ['Sheet1', 'Sheet2', 'Sheet3']

        Get index to get worksheet:
        const worksheet = workbook.getWorksheet(0);

        Get the name of the worksheet:
        const worksheet = workbook.getWorksheet('Sheet1');

        Get the contents of a cell in a row:
        const row = worksheet.getRow(0);  // Subscript 0 indicates row 1 

        Getting the contents of certain lines: 
        const rows = worksheet.getRows(0, 2);  // Get the contents of rows 1 through 3

        Get the contents of a cell in a col:
        const col = worksheet.getColumn(0);  // Subscript 0 indicates row 1 
        const col = worksheet.getColumn('A');  // A indicates row 1 

        Getting the contents of certain lines: 
        const cols = worksheet.getColumns(0, 2);  // Get the contents of cols 1 through 3

        Get the contents of a cell directly:
        const cell = worksheet.getCell('A1');
        const cell = worksheet.getCell(0, 0);

        There are many more attributes that can be viewed directly in the .d.ts declaration file...

})()

PRs are welcome!

Tests

With Jest:

pnpm i 
pnpm run test

Todo

  • Add tests
  • Supports reading of more attributes
  • Support for xls file export

Resources

other-excel's People

Contributors

zurmokeeper avatar ctyrannosaurus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.