npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@connectk12/exceljs

v0.0.11

Published

This library provides a convenient way interact with Excel spreadsheet files. It contains of the following: - Workbook functions to open and export Excel workbooks - Data functions to help update cells, find rows of data, find data groups (multiple rows)

Downloads

86

Readme

@connectk12/exceljs

This library provides a convenient way interact with Excel spreadsheet files. It contains of the following:

  • Workbook functions to open and export Excel workbooks
  • Data functions to help update cells, find rows of data, find data groups (multiple rows) for an entity, find the subsequent data group, etc.
  • Validation functions to validate whether the Excel workbook matches an expected template with column headers, etc.
  • Helper functions to handle typical scenarios that require matching data from various sources (sanitizeText, colLetterToNumber, etc.)

Special thanks

The project code uses the NPM package @zurmokeeper/exceljs v4.4.7 and exports it. The @zurmokeeper/exceljs package is forked from @exceljs/exceljs v4.3.0.

Sincere thanks to all the developers of the @exceljs/exceljs and @zurmokeeper/exceljs project.

@connectk12/exceljs specifically uses @zurmokeeper/exceljs because of its capability in opening workbooks that are password-protected, as well as other bug fixes and features, since @exceljs/exceljs was no longer being supported by the team.

Installation

To install the library, run the following command:

npm install @connectk12/exceljs

Usage

This library contains the @zurmokeeper/exceljs library, so feel free to use the library as you would with the original library. The library also contains additional functions to help with common Excel tasks.

import ExcelJS from '@connectk12/exceljs';

Documentation

For detailed information on the available methods from @zurmokeeper/exceljs, please refer to the @zurmokeeper/exceljs documentation or @exceljs/exceljs documentation.

Get Started

Here are some examples to get you started:

Example 1: Open Excel workbook, update cell, export workbook

import ExcelJS from '@connectk12/exceljs';
import { updateCell } from '@connectk12/exceljs';

Notes: Regarding getting a worksheet from a workbook:

  • Use workbook.worksheets[n] to get the nth worksheet in order, or workbook.getWorksheet("Sheet 1") to get the worksheet by name
  • workbook.getWorksheet(1) returns the worksheet at index 1, which is not always the first worksheet

Inside an async function:

const workbook = await openWorkbook({ workbookPathname: 'path/to/workbook.xlsx' });

// Get the first worksheet
const worksheet = workbook.worksheets[0]

// Get the first row and cell
const row = worksheet.getRow(1);
const cell = row.getCell(1);

// Update the cell with a value
updateCell(cell, 'Hello, World!');

// Export the workbook
const workbook = await exportWorkbook({
  workbook,
  outputPathname: 'path/to/exported/workbook.xlsx'
});

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

License

This library is licensed under the MIT License.