Read sheets dynamically from google spreadsheet.
This is an api that is backed by a Google Spreadsheet as a "database".
We need to be able to get data dynamically from a Google spreadsheet. Multiple sheets can be added to the spreadsheet and data will be returned from them without having to add a new route for the newly added sheet.
For example, this function turns this spreadsheet into this json response:
[
{
"ID": "1",
"Name": "Classic",
"Time to read": "5 mins"
}
]
The route for the sheet will be the same as the sheet name.
Consider a Google spreadsheet with multiple sheets:
| events | articles | blogs |
Route to retrieve data from events sheet:
/events
- Edit the .env file with your spreadsheet's configuration.
- The private_key in the config should be base64 encoded.
- Run the server in local mode, this would start server and read configurations from .env file.
npm run start:local