using Google Drive API to add sent data directly to a Google Sheet.
- Head to Google Developer Console and initiate Google Drive API
- Place the credentials in the
client_secret.txt
in/config
directory - Create a new google sheet and give your API client email the access to modify it
- Define the
GSHEETS_ID
constant giving it the ID of this sheet - Your API is ready and you're get to go
This API has 2 endpoint, one for sending data to the Sheet, the other is showing the homepage
-
/
: This shows homepage with a simple message -
/register
: This should be sent a POST request with the data required to be stored. Thisdata
should be a JS Object, names of the properties should be the same as the names of coloumn headings in the given sheet in order to be stored correctly.
After this you can run it as follows
cd
to the root directory of the projects and Runnpm install
- Then Run this to see it working
node .
- You should see it running on port
process.env.PORT
or4000
if local.