New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

basic-xlsx-reader

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-xlsx-reader

rust-wasm binding that uses calamine to read XLSX files

latest
Source
npmnpm
Version
0.4.1
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

rust-wasm binding that uses calamine to read XLSX files

import init, {BasicXLSXReader} from 'basic-xlsx-reader';

const readFileAsUInt8Array = (file: File): Int8Array => {
    return new Promise((resolve, reject) => {
        const reader = new FileReader();
        reader.onload = function () {
            const data = reader.result;
            const array = new Int8Array(data);
            resolve(array);
        };
        reader.onerror = reject;
        reader.readAsArrayBuffer(file);
    });
};

(async () => {
    await init();
    const input = document.querySelector('input[type=file]');
    const fileUint8Array = await readFileAsUInt8Array([input.files]);
    const basicXLSXReader = new BasicXLSXReader(fileUint8Array);
    const output = basicXLSXReader.read({
        headerRow: 1, // 0 indexed
        sheet: {name: "Test Sheet"}, // omit to get all sheets
        includeEmptyCells: true,
    });

    console.log(output);
})();

;

/*
{
  "sheets": [
    {
      "sheet": "Test Sheet",
      "row": [
        {
          "columns": [
            {
                "header": "Column 1",
                "value": "Test Cell"
            },
            {
                "header": "Column 2",
                "value": 2
            }
          ]
        }
      ]
    }
  ]
}

 */

Keywords

excel

FAQs

Package last updated on 09 Nov 2024

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