Skip to content

A Cloudflare worker that turns a Google Spreadsheet into a JSON API endpoint

License

Notifications You must be signed in to change notification settings

streamwall/sheet2json-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sheet2json-worker

A Cloudflare worker which transforms a Google Sheet into JSON.

Usage:

Edit the vars in wrangler.toml:

Follow the Cloudflare workers quickstart to fill in account_id, route, and zone_id in your wrangler.toml file.

Set the following vars to point the worker at your spreadsheet:

vars = {
  # From your spreadsheet URL: docs.google.com/spreadsheets/d/DOC_ID/...
  DOC_ID = "",
  # Name of spreadsheet tab to get data from
  SHEET_NAME = "",
  # Seconds to cache data
  TTL = "5",
}

Add an optional transform function

If you'd like to transform the data before returning it, edit transform.js.

Example:

// Only emit rows containing an id
module.exports = (rows) => rows.filter(row => row.id)

Publish!

Run npm run publish to publish your new worker.

About

A Cloudflare worker that turns a Google Spreadsheet into a JSON API endpoint

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published