-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Problem
When using Google Sheets as part of a financial data workflow, make-based build systems need to track when the sheet has been modified to trigger downstream processing. While finquick already has Google Sheets integration in sync26/syncSvc.js for transaction synchronization, we need a simple way to get modification timestamps for managing a different set of books.
Currently, there's no lightweight way to get the modification timestamp of a Google Sheet for Make dependency tracking.
Proposed Solution
Create a new package packages/makesheet/ with a Google Apps Script web app that provides a simple HTTP endpoint for getting sheet modification times.
New Package Structure
packages/makesheet/
├── README.md
├── package.json # clasp deployment scripts
├── sheetInfo.js # Google Apps Script code
├── .clasp.json # clasp configuration
└── example-usage.mk # Makefile examples
package.json (following brscript pattern)
{
"name": "makesheet",
"version": "0.1.0",
"description": "Google Sheets timestamp service for Make-based workflows",
"main": "sheetInfo.js",
"author": "Dan Connolly",
"license": "MIT",
"scripts": {
"push": "clasp push",
"deploy": "clasp push; clasp deploy --deploymentId $DEPLOYMENT_ID",
"curl": "curl -L https://script.google.com/macros/s/$DEPLOYMENT_ID/exec?sheetId=$SHEET_ID",
"login": "clasp login"
},
"devDependencies": {
"@google/clasp": "^2.3.0",
"@types/google-apps-script": "^1.0.17",
"typescript": "^4.0.5"
}
}Google Apps Script: sheetInfo.js
function doGet(e) {
const sheetId = e.parameter.sheetId;
if (!sheetId) {
return createJsonResponse({ error: "sheetId parameter required" });
}
try {
const file = DriveApp.getFileById(sheetId);
const modifiedTime = file.getLastUpdated().toISOString();
return createJsonResponse({ modifiedTime });
} catch (error) {
return createJsonResponse({ error: error.toString() });
}
}Client-side usage with curl
sheet.timestamp:
curl -s "https://script.google.com/macros/s/.../exec?sheetId=$(SHEET_ID)" | \
jq -r '.modifiedTime' | xargs -I {} touch -d {} $@Technical Details
- New package follows finquick's existing package structure with clasp deployment
- Deploy Google Apps Script as web app using
yarn deploy - Use Google Drive API to get file modification time
- Return JSON response with ISO 8601 timestamp
- Handle errors gracefully
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels