0.14.0 • Published 1 month ago

@altangent/lib-sheets v0.14.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Sheets

Basic client for reading and writing to Google Sheets from desktop applications

Examples

You need to create a project and credentials via these instructions:

import { SheetsClient } from "@altangent/lib-sheets";

// obtained from google
const credentials = {};
const scopes = ["https://www.googleapis.com/auth/spreadsheets"];

// construct a client
const client = new SheetsClient(credentials, scopes);

// obtain the code request URL
console.log(client.requestCodeUrl());

You can then navigate to the generated URL and grant access which will generate a code. This that is used to obtain a token.

const code = "<OBTAINED FROM GOOGLE>";

// request the token
client.requestToken(code).then(console.log).catch(console.error);

You can now use the token in subsequent requests.

const client = new SheetsClient(credentials, scopes, token);

// query a range
client
    .getRange("11111111111111111111111111111111111111111111", "Sheet1!A2:F")
    .then(console.log)
    .catch(console.error);

// update a range
client
    .setRange("11111111111111111111111111111111111111111111", "Sheet1!N50:P51", [
        ["1", "2", "3"],
        ["4", "5", "6"],
    ])
    .then(console.log)
    .catch(console.error);

More info:

https://developers.google.com/sheets/api/ https://developers.google.com/sheets/api/quickstart/nodejs

https://developers.google.com/sheets/api/samples/reading https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get

0.14.0

1 month ago

0.13.1

8 months ago

0.13.2

8 months ago

0.12.9

1 year ago

0.12.7

2 years ago

0.12.8

2 years ago

0.12.2

2 years ago

0.12.3

2 years ago

0.12.4

2 years ago

0.12.5

2 years ago

0.12.6

2 years ago

0.12.0

2 years ago

0.12.1

2 years ago

0.11.0

2 years ago

0.11.1

2 years ago

0.10.5

2 years ago

0.10.1

2 years ago

0.10.2

2 years ago

0.10.3

2 years ago

0.10.4

2 years ago

0.10.0

2 years ago

0.9.1

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.3

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago