A generic TypeScript library for AppSheet CRUD operations, designed for building MCP servers and internal tools.
- 🚀 Full CRUD operations for AppSheet tables
- 📝 Runtime schema loading from YAML/JSON
- 🔧 CLI tool for schema generation and management
- 🔒 Type-safe API with TypeScript
- 🌐 Multi-instance support (multiple AppSheet apps)
- ✅ Schema-based validation
- 🔄 Connection management with health checks
Install directly from the GitHub repository:
npm install git+ssh://[email protected]:techdivision/appsheet.gitOr specify a specific branch or tag:
# Install from a specific branch
npm install git+ssh://[email protected]:techdivision/appsheet.git#main
# Install from a specific tag/version
npm install git+ssh://[email protected]:techdivision/appsheet.git#v0.1.0Add to your package.json:
{
"dependencies": {
"@techdivision/appsheet": "git+ssh://[email protected]:techdivision/appsheet.git"
}
}npm install @techdivision/appsheetUse the CLI to automatically generate schema from your AppSheet app:
# Generate schema for specific tables
npx appsheet inspect \
--app-id "your-app-id" \
--access-key "your-access-key" \
--tables "worklog,issues,employees"
# Or let it discover tables automatically
npx appsheet inspect \
--app-id "your-app-id" \
--access-key "your-access-key"This creates config/appsheet-schema.yaml with your table definitions.
import { SchemaLoader, SchemaManager } from '@techdivision/appsheet';
// Load schema
const schema = SchemaLoader.fromYaml('./config/appsheet-schema.yaml');
const db = new SchemaManager(schema);
// Use type-safe table clients
interface Worklog {
id: string;
date: string;
hours: number;
description: string;
}
const worklogsTable = db.table<Worklog>('worklog', 'worklogs');
// CRUD operations
const worklogs = await worklogsTable.findAll();
const today = await worklogsTable.find('[date] = "2025-10-27"');
await worklogsTable.add([
{ id: '123', date: '2025-10-27', hours: 8, description: 'Work done' }
]);
await worklogsTable.update([{ id: '123', hours: 7 }]);
await worklogsTable.delete([{ id: '123' }]);# Initialize empty schema
npx appsheet init
# Inspect and generate schema
npx appsheet inspect --app-id <id> --access-key <key> --tables <tables>
# Add a table to existing schema
npx appsheet add-table <connection> <tableName>
# Validate schema
npx appsheet validateFor simple use cases without schema files:
import { AppSheetClient } from '@techdivision/appsheet';
const client = new AppSheetClient({
appId: process.env.APPSHEET_APP_ID!,
applicationAccessKey: process.env.APPSHEET_ACCESS_KEY!,
runAsUserEmail: '[email protected]', // Optional: run operations as specific user
});
// CRUD operations
const rows = await client.findAll('Users');
const user = await client.findOne('Users', '[Email] = "[email protected]"');
await client.addOne('Users', { name: 'John', email: '[email protected]' });
await client.updateOne('Users', { id: '123', name: 'John Updated' });
await client.deleteOne('Users', { id: '123' });
// Override runAsUserEmail for specific operation
await client.add({
tableName: 'Users',
rows: [{ name: 'Jane' }],
properties: { RunAsUserEmail: '[email protected]' }
});Manage multiple AppSheet apps in one project:
# config/appsheet-schema.yaml
connections:
worklog:
appId: ${APPSHEET_WORKLOG_APP_ID}
applicationAccessKey: ${APPSHEET_WORKLOG_ACCESS_KEY}
tables:
# ...
hr:
appId: ${APPSHEET_HR_APP_ID}
applicationAccessKey: ${APPSHEET_HR_ACCESS_KEY}
tables:
# ...const worklogTable = db.table('worklog', 'worklogs');
const employeeTable = db.table('hr', 'employees');See the examples/ directory for complete examples:
basic-usage.ts- Direct client usageschema-based-usage.ts- Schema-based usageconfig/example-schema.yaml- Example schema file
npm installnpm run buildnpm testnpm run lint
npm run formatMIT