SheetLatch / Guides

Fetch Google Sheet data in JavaScript

One fetch call. The rows come back as an array of objects.

const url = new URL("https://sheetlatch-api.quietlathe.com/v1/SHEET_ID/Products");
url.searchParams.set("in_stock", "true");
url.searchParams.set("limit", "10");

const res = await fetch(url, { headers: { "x-api-key": process.env.SHEET_API_KEY } });
if (res.status === 429) throw new Error("Monthly quota reached");
const rows = await res.json();
console.log(res.headers.get("x-cache"), rows.length);

Check x-quota-remaining if you want to show a warning before the limit. See the docs for every parameter.

Early access. SheetLatch opens soon. Join the early-access list and we will email you once when it does. Planned free plan: 1,000 requests a month. SheetLatch is not affiliated with Google.