Skip to content

Function: Spreadsheet()

Spreadsheet(sheetsId, globalOptions): object

Define a spreadsheet corresponded to a Google Sheets document.

Parameters

ParameterTypeDescription
sheetsIdstringGoogle Sheets ID can be found from the URL docs.google.com/spreadsheets/d/{sheetsId}/
globalOptionsSheetOptionsSheetOptions 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

ParameterTypeDescription
sheetstringThe sheet name
schemaTOutput schema mapping of each row
optionsSheetOptionsSheetOptions

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');

Defined in

src/parser/spreadsheet.ts:36

Released under the MIT License.