Function: Spreadsheet()
Spreadsheet(
sheetsId
,globalOptions
):object
Define a spreadsheet corresponded to a Google Sheets document.
Parameters
Parameter | Type | Description |
---|---|---|
sheetsId | string | Google Sheets ID can be found from the URL docs.google.com/spreadsheets/d/{sheetsId}/ |
globalOptions | SheetOptions | SheetOptions which will be applied in every .get call |
Returns
object
A spreadsheet object
get()
Fetch and parse the sheet from given sheet name.
Type Parameters
Type Parameter |
---|
T extends TCsvSchema |
Parameters
Parameter | Type | Description |
---|---|---|
sheet | string | The sheet name |
schema | T | Output schema mapping of each row |
options | SheetOptions | SheetOptions |
Returns
Promise
<StaticDecode
<T
>[]>
An array of objects corresponded to the sheet definition
Throws
If fail to fetch or parse the sheet
Example
ts
const output = await sheets.get('SheetName', schema);
Example
ts
const sheets = Spreadsheet('google-sheets-id');