0.2.0 • Published 10 months ago
gsheet-api-helper v0.2.0
Google Spreadsheet API Helper
Google Spreadsheet API Helper is a Node.js package that provides a helper for simplifies the process of accessing, retrieving and updating data from Gsheet using the Gsheet API.
Prerequesite
- Create OAuth 2.0 Google click here
- Invite iam account to the spreadsheet you want to access
Installation
To install the package, you can use npm:
npm install gsheet-api-helper
The Basic
import GoogleSheetHelper from 'GoogleSheetHelper';
const gsheet = new GoogleSheetHelper(<googleApisIss>, <googleApisPrivateKey>);
Get Data
const response = gsheet.get(<sheetId>, <sheetName>, <range>);
console.log(response) // <-- see the response
console.log(response.values) // <-- get the values
Example Response:
{
range: '<sheetName>!<range>',
majorDimension: 'ROWS',
values: [<data>]
}
Batch Update
const response = gsheet.batchUpdate(<sheetId>, <sheetName>, <range>, <values>);
console.log(response) // <-- see the response
console.log(response.values) // <-- get the values
Append
const response = gsheet.append(<sheetId>, <sheetName>, <values>);
console.log(response) // <-- see the response
console.log(response.values) // <-- get the values