What you are actually trying to accomplish is authentication between the server and Google.
Thus, when a visitor visits your pages, you will capture data from your own table without the participation of a third party.
You may find what you are looking for, a Google service account and here
In addition, another solution (which is much simpler to execute, but may have some delays) is to use the oauth 2.0 protocol with your Google dev account (obtained from the Google Console API).
- If you havenβt already done so, create a Google Dev account (Google Console API)
- Create an access / update token for your application with an offline grant - this means that you can send API requests with your account to your spreadsheet, even if you are not logged in with your spreadsheet account.
- Save the updated token that you created and use it to create the access token again and again (access tokens last 1 hour).
Refreshing the token should not expire, but in case of it, you can always generate it again and replace the one you had with the new one and save access tokens with it.
The basic set in case your update token is invalid, you will have to manually replace it, since you will need to re-grant access to your developer account in order to access your spreadsheet account.
Hope this helps a bit.
Meny
source share