All API interactions are performed using scripts/workspace.js exec. You must provide the --email flag to specify which account profile to use.
Command Syntax
node scripts/workspace.js exec --email <account@example.com> <<'JS'
// Your JavaScript code here
JS
Available Global Objects in exec scripts
auth: The authorized OAuth client.google: The googleapis root object.workspace.accountEmail: The email address of the currently selected profile.workspace.call(service, methodPath, params, {version}): Executes a specific API method.workspace.service(service, {version}): Returns a service instance.workspace.whoAmI(): Returns information about the current authenticated user.
Optional CLI Flags
--timeout <ms>: Sets execution timeout (default 30000, max 300000).--scopes s1,s2: Specifies required OAuth scopes.--script 'return 42': Alternative way to pass a script string.
node scripts/workspace.js exec --email user@example.com <<'JS'
const me = await workspace.whoAmI();
const files = await workspace.call('drive', 'files.list', {
pageSize: 5,
fields: 'files(id,name,mimeType)',
});
return { me, files: files.files };
JS