Keep your Tracker in a Google Sheet
A “Tracker” tab that refreshes itself every morning with each open item's stage, deadline, amount, notes and link. You need a Google account and a Grantlas Pro API key. A read-only key is enough.
Set it up
- Make a new Google Sheet.
- Choose Extensions → Apps Script. Delete what's there, paste the script below, and choose Save.
- In Apps Script, choose Project Settings (the gear), then Add script property twice:
GRANTLAS_API_KEYwith your key, andGRANTLAS_ORG_IDwith your organization's id, shown under API keys in Settings (it starts withorg_, likeorg_3f9a1c0e7b2d4a61). The key stays out of the script's code. Share the Sheet as view-only: anyone who can edit it can open Apps Script and see the key. - Back in the editor, pick refreshTracker and choose Run. Google asks you to allow it. If it says “Google hasn't verified this app”, choose Advanced, then Go to (your project). That's expected: it's your own script. Then choose Allow. The Tracker tab fills in.
- Choose Triggers (the clock), then Add Trigger: function refreshTracker, Time-driven, Day timer, 6am to 7am. Choose Save.
Apps Script
// Refreshes the "Tracker" tab from Grantlas. Needs script properties GRANTLAS_API_KEY and GRANTLAS_ORG_ID.
function refreshTracker() {
const props = PropertiesService.getScriptProperties();
const key = props.getProperty("GRANTLAS_API_KEY");
const org = props.getProperty("GRANTLAS_ORG_ID"); // like org_3f9a1c0e7b2d4a61
const rows = [["Name", "Type", "Stage", "Deadline", "Amount requested", "Notes", "Updated", "Link"]];
for (let page = 1; ; page++) {
const res = UrlFetchApp.fetch(
`https://api.grantlas.com/v1/orgs/${org}/tracker?stage=open&per_page=100&page=${page}`,
{ headers: { Authorization: `Bearer ${key}` }, muteHttpExceptions: true },
);
const body = JSON.parse(res.getContentText());
if (res.getResponseCode() !== 200) throw new Error(body.message);
for (const t of body.data) {
rows.push([t.name, t.type, t.stage_label, t.deadline || "", t.amount_requested || "", t.notes || "", t.updated_at, t.url]);
}
if (page >= body.total_pages) break;
}
const sheet = SpreadsheetApp.getActive().getSheetByName("Tracker") || SpreadsheetApp.getActive().insertSheet("Tracker");
sheet.clearContents();
sheet.getRange(1, 1, rows.length, rows[0].length).setValues(rows);
}Good to know
The script replaces the whole Tracker tab each time, so make your own notes in another tab. For another client, make another Sheet with that organization's id. If the key is revoked, the morning run stops, and Google emails you when a scheduled run fails.
Other recipe: Get new grant matches in Slack or email · API reference