sheet-convert

1.0.2 • Public • Published

npm version

sheet-convert

Converts a Google Sheet to a JSON array, or vice versa.

Table of contents

Installation

To install the library, run:

$ npm install sheet-convert

or with JSDelivr:

<script src="https://cdn.jsdelivr.net/npm/sheet-convert@latest/file"></script>

Importing

With require:

const { Sheet, from } = require("sheet-convert");

With import:

import { Sheet, from } from "sheet-convert";

Usage

Generating JSON from a Sheet

import Parser from "sheet-convert";

const sheet = new Parser.Sheet([id]); // If getting the main spreadsheet page
const sheet = new Parser.Sheet([id], [subsheet]) // If getting a specific sheet

const info = await sheet.fetch() // Array of JSON objects

Generating a Sheet from JSON

import Parser from "sheet-convert";

const sheet = Parser.from([{a: 1, b: 2}, {b: 3, c: 4}]) // Full JSON
const sheet = Parser.from([{a: 1, b: 2}, {b: 3, c: 4}], ['c']) // JSON excluding "c"

Output

Full JSON

a b c
1 2
3 4

Excluding "c"

a b
1 2
3

Readme

Keywords

Package Sidebar

Install

npm i sheet-convert

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

5.41 kB

Total Files

3

Last publish

Collaborators

  • else1f