This example uses the Google APIs Node.js Client package included in the Wix Package Manager to access a Google Sheet . Using built-in code packages is easier and more convenient than having to write your own interface code.
You will need a Google Account where you can create a Sheet to be used as the “target" of the app. The Home page of this app is a form on which the user can enter data that will be saved to the Google Sheet . Before the Home page form can be used, you will need to configure the app to access the Sheet .
Google APIs use the OAuth 2.0 protocol for authentication and authorization. The Configuration page provides a step-by-step process for you to configure the app to access a Google Sheet . At the end of the configuration process, the form on the Home page can be filled in and the data saved to the Sheet .
Thanks to my Wix colleague Gal who provided the original POC.
Hi guys! The get code button doesn’t seem to be working for me. I must be doing something wrong! I’ve enabled the Google Sheets API and downloaded the configuration file. Then copied the text code into the text box and pressed enter. The enter doesn’t seem to be doing anything- it just moves the text cursor to the line below, as you would expect on any word document.
I then create a new Sheet in Google docs and copy it’s URL into the second text box and hit enter. Nothing really happens here either. After this the ‘Get Code’ button still doesn’t seem to work for me. Could anyone enlighten me on what I’m doing wrong?
I tried your site and it works fine for me. I entered in the text for the client configuration, hit enter, and I get a check mark showing that it was accepted. I then do the same for the Google sheet URL and get a check mark for that as well:
Your site appears to be working OK for me. Do you get the checkmarks as well?
It seems that you have incorrect permissions on database collection and the insert to the collection is failing. Not sure why this is happening however. Are you running this in Live mode? I’ve been testing Preview from the editor and it works fine, however you might need to adjust the permissions to allow Live mode. This app has also been tested in Live so I’m a bit puzzled why this is happening.
@yisrael-wix Yes I was testing in live. Just tried preview and it’s all working! How might I adjust the permissions? Thanks a bunch for this Yisrael, really appreciate your support.
The wixData.insert() statements were missing the options ( suppressAuth ) parameter which allows the insert() to override the db authorization. See WixDataOptions for more information.
I fixed the example template and I also fixed your backend code to include options in the inserts. You will need to publish - and then try it again.