AppSheetApp
A Google Apps Script wrapper for the Google AppSheet API
AI Summary
AppSheetApp
Access AppSheet API from Apps Script to manage table records and invoke actions.
Target Users
Intermediate Apps Script developers automating data operations in AppSheet Enterprise apps.
Problems Solved
Perform CRUD operations on AppSheet tables and invoke actions from Apps Script without raw HTTP requests.
Script ID
- In GAS Editor: Click "Libraries +" → Paste into "Script ID" field → Click "Look up"
- "AppSheetApp" will appear in the search results
- Select the latest version (highest number) from "Version" dropdown
- Click "Add"
Tags
Main Features
1
Easy Connection
Use connect(appId, accessKey) to link Apps Script to AppSheet app securely.
2
Table CRUD
Add, Delete, Edit, Find methods handle table record creation, deletion, update, read.
3
Action Invoke
Action method invokes defined AppSheet actions on table rows.
Examples
Main Functions
| Function | Description |
|---|---|
| AppSheetApp.connect(appId, applicationAccessKey) | Connect to AppSheet app. |
| Add(tableName, rows, properties) | Add records to a table. |
| Find(tableName, rows, properties) | Read records from a table. |
Examples
Add rows to table
/**
* テーブルにレコード追加
* ・AppSheet接続: AppSheetApp.connect('YOUR_APP_ID', 'YOUR_ACCESS_KEY')
* ・rows配列準備: [{ "FirstName": "Jan", "LastName": "Jones", ... }]
* ・Add実行: AppSheet.Add('People', rows)
*/
function addRowsToTable() {
const AppSheet = AppSheetApp.connect('YOUR_APP_ID', 'YOUR_ACCESS_KEY');
const rows = [
{
"FirstName": "Jan",
"LastName": "Jones",
"Age": 33,
"Department": "Accounting",
},
{
"FirstName": "Ian",
"LastName": "Ivans",
"Age": 22,
"Department": "Payroll",
}
];
const resp = AppSheet.Add('People', rows);
console.log(resp);
}Find rows with conditions
/**
* 条件付きレコード取得
* ・AppSheet接続: AppSheetApp.connect('YOUR_APP_ID', 'YOUR_ACCESS_KEY')
* ・properties設定: { "RunAsUserEmail": "an.example@email.com", "Selector": "Filter(People, [Age] >= 21)" }
* ・Find実行: AppSheet.Find('People', [], properties)
*/
function findRowsInTable() {
const AppSheet = AppSheetApp.connect('YOUR_APP_ID', 'YOUR_ACCESS_KEY');
const properties = {
"RunAsUserEmail": "an.example@email.com",
"Selector": "Filter(People, [Age] >= 21)"
};
const resp = AppSheet.Find('People', [], properties);
console.log(resp);
}