DEV Community

Алексей Спинов
Алексей Спинов

Posted on

How to Scrape Notion, Airtable, and Google Sheets (Public Data)

Many businesses share data through Notion pages, Airtable bases, and Google Sheets. Here is how to access them.

Google Sheets (Easiest)

Published Google Sheets have a JSON endpoint:

https://docs.google.com/spreadsheets/d/SHEET_ID/gviz/tq?tqx=out:json
Enter fullscreen mode Exit fullscreen mode
async function getGoogleSheet(sheetId) {
  const url = `https://docs.google.com/spreadsheets/d/${sheetId}/gviz/tq?tqx=out:json`;
  const res = await fetch(url);
  const text = await res.text();
  // Remove callback wrapper
  const json = JSON.parse(text.match(/google.visualization.Query.setResponse\((.*)\)/s)[1]);
  return json.table;
}
Enter fullscreen mode Exit fullscreen mode

Notion (API)

Notion has a free API:

async function getNotionPage(pageId, token) {
  const res = await fetch(`https://api.notion.com/v1/pages/${pageId}`, {
    headers: { Authorization: `Bearer ${token}`, "Notion-Version": "2022-06-28" }
  });
  return res.json();
}
Enter fullscreen mode Exit fullscreen mode

Airtable (API)

Airtable API is free with your account:

https://api.airtable.com/v0/BASE_ID/TABLE_NAME?api_key=YOUR_KEY
Enter fullscreen mode Exit fullscreen mode

Use Cases

  1. Data migration between platforms
  2. Backup automation
  3. Cross-platform dashboards
  4. Automated reporting

Resources


Need data migrated or extracted from SaaS tools? $20-50. Email: Spinov001@gmail.com | Hire me

Top comments (0)