Fetch data from google sheet using React

Viewed 719

I would like to fetch data from the google sheet with React.

I tried to use the following libraries https://github.com/ruucm/react-google-sheets https://github.com/gglukmann/use-google-sheets

However, it always requires setting the file permission to "Anyone with this link can view". We don't want to share the file outside our org. If we do this, the client cannot read the data from google sheet.

Is there any way that I can fetch data from a restricted google sheet? Thank you

1 Answers

You need to use the Google Sheets API to connect to the Sheet and fetch the data.

The application would need to be authorised to run as the person who owns or is an editor of the sheet. Check out the node.js quickstart for setting up an application in the cloud console. The method you need to get data is spreadsheets.values.get.

Related