Google Sheets API wrapper module for Trivious framework
npm install @trivious/sheets
pnpm add @trivious/sheets
yarn add @trivious/sheetsRequires Node.js 18+
This module is intended to be used with a Google Service Account, refer to Google Cloud Documentation on how to create one.
import { SheetsClient } from "@trivious/sheets";
const sheets = new SheetsClient({
spreadsheetId: "1ABCefG",
// Key credentials can be loaded in however you like as long as the client email and private key are passed
// To get these credentials, create a new key on the service account and download the JSON file
key: {
client_email: "account@project.iam.gserviceaccount.com",
private_key: "-----BEGIN PRIVATE KEY-----\nABC123"
}
});
await sheets.appendRow({
sheetName: "Sheet 1",
columns: { from: "A", to: "C" },
values: [["Hello", "World"]]
});