GoogleSheets API
Provides methods to read data from public Google Sheets.
Static Methods
GoogleSheets.readSheet(spreadsheetId: string, sheetName?, options?)- Read Google SheetsGoogleSheets.readFromUrl(url: string, sheetName?, options?)- Read from Google Sheets URLGoogleSheets.extractId(url: string)- Extract spreadsheet ID from URL
Parameters
spreadsheetId- The Google Sheets ID from the URLsheetName- Name of the sheet (default: "Sheet1")options- CSV parsing optionsurl- Full Google Sheets URL
Example
import { GoogleSheets } from "@pinta365/boxframe";
// From spreadsheet ID
const df = await GoogleSheets.readSheet("1ABC123...");
// From full URL
const df2 = await GoogleSheets.readFromUrl(
"https://docs.google.com/spreadsheets/d/1ABC123.../edit"
);
// Specific sheet with options
const df3 = await GoogleSheets.readSheet("1ABC123...", "Data", {
delimiter: ",",
hasHeader: true
});
Notes
- Only works with public Google Sheets
- Sheets must be publicly accessible
- Uses Google's CSV export API