Netzo Logo

googleappsheet

Google AppSheet is a no-code development platform.

Usage

import { googleappsheet } from 'netzo/apis/googleappsheet.ts'

const api = googleappsheet({
  appId: Deno.env.get('GOOGLEAPPSHEET_APP_ID'),
  applicationAccessKey: Deno.env.get('GOOGLEAPPSHEET_APPLICATION_ACCESS_KEY'),
})

Configuration

The googleappsheet factory function expects an object with the following, and returns an object with an API client api.

ParamTypeDefaultDescription
applicationAccessKeystringDeno.env.get('GOOGLEAPPSHEET_APPLICATION_ACCESS_KEY')the access key to use for authentication
appIdstringDeno.env.get('GOOGLEAPPSHEET_APP_ID')the unique identifier for the app
Refer to the API documentation to get the required information.

Examples

The following examples assume you have created an api client instance.

Find records

Find records in a table.

const query: QueryRecords = { Action: 'Find' }
const result = await api[TABLE_NAME].Action.get<Records>(query)
const resultData = result.Rows

Add records

Add one or multiple rows to a table.

const data: DataAddRecords = {
  Action: 'Add',
  Rows: [{
    FIELD: 'NEW_VALUE'
  }]
}
const result = await api[TABLE_NAME].Action.post<Records>(data)
const resultData = result.Rows

Update records

Update one or multiple rows.

In the request, each row must include the key fields and values that identify the row to be updated.

const data: DataUpdateRecords = {
  Action: 'Edit',
  Rows: [{
    KEY_FIELD: 'KEY_VALUE',
    FIELD: 'UPDATE_VALUE'
  }]
}
const result = await api[TABLE_NAME].Action.post<Records>(data)
const resultData = result.Rows

Delete records

Delete one or multiple rows.

In the request, the row to be deleted is identified by the key fields and values specific to the app.

const query: QueryDeleteRecords = {
  Action: 'Delete',
  Rows: [{
    KEY_FIELD: 'KEY_VALUE'
  }]
}
const result = await api[TABLE_NAME].Action.post<Records>(query)
const resultData = result.Rows

References