@ulu/vite-plugin-sheetjs

0.0.1 • Public • Published

Vite Plugin Sheetjs

This plugin will convert spreadsheets into JSON when imported. Apply the suffix ie. file.xlsx?sheetjs to load as JSON, optional "name" query can be used to get only specific sheet(s). See usage details below.

Note this plugin is only for transforming spreadsheet files into data, not for adding sheetjs to project, etc.

This plugin is based on the example from sheet js and uses the xlsx NPM module.

Usage

// Returns an object of sheets by name 
// ie. { sheetName: JSON, sheetName2: JSON, ... }
import all from "./example.xlsx?sheetjs";

// Only specific sheet name
import query1 from "./example.xlsx?sheetjs&name=test2";
import query2 from "./example.xlsx?sheetjs&name=test&name=test2";

Vite Setup

import { defineConfig } from "vite";
import sheetjsPlugin from "@ulu/vite-plugin-sheetjs";

export default defineConfig({
  plugins: [
    sheetjsPlugin(),
  ],
})

Package Sidebar

Install

npm i @ulu/vite-plugin-sheetjs

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

5.08 kB

Total Files

6

Last publish

Collaborators

  • jscherbe