google-spreadsheet-promise
A light-weight promise wrapper around NPM google-spreadsheet.
Helpful link on limits of Google spreadsheets.
Usage
const gsp = // a spreadsheet key is the long id in the sheets URLconst key = '1fyGsYhinmTRNpJyw_uVDpI3wYmWz9FXIYgR2DuobZ_w'// see Auth help/tips belowconst credsPath = './google-generated-creds.json' // Note- assumed to be in a generator for "yield":const sheets = gsp // Syntax #1: any-sheet syntax:const sheetsInfo = sheetsconst headerRow = sheets // 1-based indexing of sheetsconst rows = sheetsconst cells = sheetsconst data = sheets sheets // Syntax #2: single-sheet syntax:const sheetOne = sheets // 1-based indexing of sheets const sheetOneInfo = sheetOneconst headerRow = sheetOneconst rows = sheetOneconst cells = sheetOneconst data = sheetOne sheetOne
Full list of promisified functions
const funcs = { setTitle, getInfo, getRows, * getCells, * bulkUpdateCells, addRow, setHeaderRow, getHeaderRow, resize, clear, del }
* Note: Returned row
s and cell
s have a .promise
property added to them, where .save()
, .del()
, etc are found. This helps maintain API compatibilities, including bulkUpdateCells()
.
Notes
See test/test.js for other examples.
See google-spreadsheet for more options.
Auth help/tips.