Skip to content
On this page
netzo/apis/googleappsheet

Google AppSheet

Google AppSheet is a no-code development platform that lets you build apps for your business using spreadsheets and forms.

  • labels: development, no-code, low-code, mobile-apps, web-apps
  • authentication: apiKey

Usage

ts
import { googleappsheet } from 'https://deno.land/x/netzo/apis/googleappsheet/mod.ts'

const { api } = googleappsheet({
  appId: Deno.env.get('GOOGLEAPPSHEET_APP_ID'),
  applicationAccessKey: Deno.env.get('GOOGLEAPPSHEET_APPLICATION_ACCESS_KEY'),
})
import { googleappsheet } from 'https://deno.land/x/netzo/apis/googleappsheet/mod.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 HTTP 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. Refer to the type definitions for all exported types to pass to the api client for typed responses.

Find records

Find records in a table.

ts
import type { QueryRecords, Records } from 'netzo/apis/googleappsheet/types.ts'

const query: QueryRecords = { Action: 'Find' }
const result = await api[TABLE_NAME].Action.get<Records>(query)
const resultData = result.Rows
import type { QueryRecords, Records } from 'netzo/apis/googleappsheet/types.ts'

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.

ts
import type { DataAddRecords, Records } from 'netzo/apis/googleappsheet/types.ts'

const data: DataAddRecords = {
  Action: 'Add',
  Rows: [{
    FIELD: 'NEW_VALUE'
  }]
}
const result = await api[TABLE_NAME].Action.post<Records>(data)
const resultData = result.Rows
import type { DataAddRecords, Records } from 'netzo/apis/googleappsheet/types.ts'

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.

ts
import type { DataUpdateRecords, Records } from 'netzo/apis/googleappsheet/types.ts'

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
import type { DataUpdateRecords, Records } from 'netzo/apis/googleappsheet/types.ts'

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.

ts
import type { QueryDeleteRecords, Records } from 'netzo/apis/googleappsheet/types.ts'

const query: QueryDeleteRecords = {
  Action: 'Delete',
  Rows: [{
    KEY_FIELD: 'KEY_VALUE'
  }]
}
const result = await api[TABLE_NAME].Action.post<Records>(query)
const resultData = result.Rows
import type { QueryDeleteRecords, Records } from 'netzo/apis/googleappsheet/types.ts'

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