gglukmann / use-google-sheets Goto Github PK
View Code? Open in Web Editor NEW๐ A React Hook for getting data from Google Sheets API v4
License: MIT License
๐ A React Hook for getting data from Google Sheets API v4
License: MIT License
Hello. I've been using this hook for an app I'm building that uses a Google Sheet as the data source. It's been great to use and super easy to set up (specially compared to a lot of the other options out there) but I've got an issue where a column I need to view has a link in the data.
This is just returning as a flat string value like "TRK-FORD-13-433" rather than the actual contents of the cell I was expecting.
If I'm just not doing something correctly then please let me know, otherwise is there a way around this?
Thanks
Hi,
Thanks for this nice library! very easy to use!
I found out although I put my api key and sheet id in .env file, after I deploy my app, user can see the requested url in the network tab in browser console, which contains the api key and sheet id...
I am not sure though, do you think we can use post request or some other way to secret the url?
Thanks again!
Row zero may contain the table head, or it may contain data. Please dont discard it. Now I will have to use map-reduce to get the table head out of it. (or make a PR)
Hi, thanks a lot for this great project. I have a question / feature request.
Currently when i have an image in a cell in a sheet, the hook returns an empty string.
activityDescription: "Taking the bike to the barber"
activityImage: ""
experienceValue: "0"
needs: ""
stage: "Before"
Is it possible to retrieve the URL to that image? I think this would be a very useful feature.
Hi. I'm receiving the error "The caller does not have permission" when running this.
I've configured the app in Google Console to allow the Google Sheets APIโcreating an API Key and a Service Account. The API Key is used in the app as GATSBY_GOOGLE_SHEETS_API_KEY
, GATSBY_GOOGLE_SHEETS_SHEET_ID
added from the Sheet URL, and the Service Account email was added to the Google Sheet with full Editor permissions.
I'm not entirely sure which apiKey value to set in the application env variable. Where is the correct API Key found/created? Is it created in the Service Account, the general Credentials settings in Console, or one of the values in the json file credentials?
Application Code (typescript)
const { data, loading, error } = useGoogleSheets({
apiKey: process.env.GATSBY_GOOGLE_SHEETS_API_KEY as string,
sheetId: process.env.GATSBY_GOOGLE_SHEETS_SHEET_ID as string,
});
Console error:
{
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
Im rewriting my display of the data now (a table) - react-table wants a memoized data set. Is the data memoized? I'm sorry I'm kind of a noob. If not memoized how do i memoize it?
const {
data: sheetData,
loading,
error,
} = useMemo(() => {
return useGoogleSheets({
apiKey: GAPI_CONFIG.apiKey,
sheetId,
});
}, [sheetId]);
React Hook "useGoogleSheets" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.
Searching for a few minutes already - where in the cloud console and which scopes are required?
must Gapi already be installed in the project?
Basically I need a way to pull in the data of a spreadsheet that does not use the first row as its header.
For example with...
https://docs.google.com/spreadsheets/d/1nh82R5ROEV1idhYQeujsBNM9mNEatkISdbqQYvR6ZZI/edit?usp=sharing
I want to be able to do something like...
useGoogleSheets({
apiKey: APIKEY,
sheetId: GOOGLESHEETID,
headerRow: 7,
});
To tell it to use the 7th row as the header instead of the first and ignore everything above it.
Thanks!
Hi,
Now, we can only fetch data from a sheet that has the permission "Anyone with this link can view". Is it possible that we can also read the data from a restricted sheet (only shared with some specific emails)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.