1.0.2 • Published 11 months ago

sheet-convert v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

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

abc
12
34

Excluding "c"

ab
12
3
1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago