FabricFabricSDK
Plugins

Google Sheets

Read, append, update, and clear values in Google Sheets via OAuth.

Authentication

TypeDefaultDetails
oauth_2Google OAuth with the https://www.googleapis.com/auth/spreadsheets scope

The plugin's oauthConfig defaults to access_type=offline + prompt=consent so you get a refresh token on first authorization.

Endpoints

PathRiskDescription
spreadsheets.getreadSpreadsheet metadata + sheet list.
values.getreadRead values from a range ('Sheet1!A1:C100').
values.appendwriteAppend rows to a range.
values.updatewriteOverwrite values at a range.
values.cleardestructiveClear values at a range (formatting preserved).

values.get

const { values } = await fabric.googlesheets.api.values.get({
  spreadsheetId: '1abcDEF...',
  range: 'Sheet1!A1:E10',
});

values.append

await fabric.googlesheets.api.values.append({
  spreadsheetId: '1abcDEF...',
  range: 'Sheet1!A:E',
  values: [
    ['Customer', 'Email', 'Plan', 'MRR', 'Created'],
    ['Acme', 'ar@acme.com', 'Pro', 99, new Date().toISOString()],
  ],
  valueInputOption: 'USER_ENTERED',
});

valueInputOption: 'USER_ENTERED' lets Sheets parse formulas + dates; 'RAW' writes literal strings.

Factory

import { googleSheets } from '@fabricorg/integrations/plugins';

const fabric = createFabric({
  plugins: [
    googleSheets({ accessToken: process.env.GOOGLESHEETS_ACCESS_TOKEN }),
  ],
});

Pair with refreshAccessToken from @fabricorg/integrations/oauth to keep tokens current.