Sheetlog is a library for logging and retrieving data from Google Sheets. It is designed to be easy to use and integrate into existing projects.
Github repo: https://github.com/janzheng/sheetlog
Live test sheet: Google Sheet
It can either be used in Node:
import { Sheetlog } from '@yawnxyz/sheetlog'; const sheet = new Sheetlog({ sheetUrl: 'YOUR_SHEET_URL', sheet: 'Sheet1', }); await sheet.log({ message: 'Hello world' }); // Basic logging await sheet.get('123'); // Get by ID await sheet.put('123', { message: 'Updated' }); // Update by ID await sheet.delete('123'); // Delete by ID
Or as POST requests directly to the Apps Script:
// Simple POST request example const response = await fetch('YOUR_SHEET_URL', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ method: 'POST', sheet: 'Sheet1', payload: { message: 'Hello from API', timestamp: new Date().toISOString() } }) });
As you try the examples below, the commands will be sent to the Apps Script in the above URL, and either read or write to the Google Sheets connected to the app.
This demo uses the following Google Sheet: https://docs.google.com/spreadsheets/d/15XoANPN-DAyBkQlN9-s7bCaWzDNibuWTXHFCQMISVK4/edit?usp=sharing