Is there a way to copy the elements in your example site ( @yisrael-wix ) into another Wix site without having to rebuild and redefine all the elements from scratch to connect to the page code?
I have installed the googleapis node module and copied and pasted the code for config and googleSheet jsw files to the into the backend site structure. Is adding new web modules to the backend and copy pasting the code the most effective way to do this?
I know zero JavaScript so am sure I’m missing something crucial! Just to be clear, all I need to do is to get this system to work on another Wix site.
The configuration phase is done once and it’s result is a table with all the needed configurations for the google api.
If you look at it that way you do not need to copy this page to your site, you can crate site from the example, do the configuration phase, and create a table in you site with the same name, permissions, data and fields.
then you need to copy only the home page and backend files to your site.
Nevertheless you will need some minimal coding skills in order to customize the form to your own needs.
@gal-morad thanks for the reply. Apologies for my complete ignorance but what are you talking about when you refer to ‘configuration phase’? And when you say copy the home page and backend files are you talking about copying the JS page code on the home page, and the JS code for the config and googleSheet backend files?
The configuration page - lets you configure your application to work with google.
The home page - this is the form you use at your site.
Using it at your site will have two phases:
Follow the instructions in the configuration page (what I called the configuration phase). this is done only once, before you expose the form in the home page to your users.
After this phase the configuration page is no longer needed. And the page should not be exposed to users in anyway.
Expose the form in the homepage to your users, where they can submit data to the google sheet configured at the first phase.
By copying I meant copying the js code from the homepage and back end as you described well, you need to set UI components on the stage with the same events and names as the example page.
you will also need to add the googleapi npm package , you do that by selecting node modules → install new package → googleapi
@gal-morad Ah I see! So no need to copy the configuration page over, great! I believe I have done 95% of the work but something is still going wrong and I’m not quite sure what. Here are steps I have taken so far:
Completed the configuration phase on the configuration page in the example website. (I’ve tested it on the example site’s home page and it works).
Installed the googleapis node module in backend
Created a config.jsw file and googleSheet.jsw file in backend and copied the relevant JS code from the example site.
Recreated and properly labeled and set events for the UI components (2x text box and save button) in new site. Then copied the JS code from the example site’s home page and pasted into the new site’s page.
Created a new database collection with the same name and settings as the example site and entered in the relevant fields.
Are these the right sequence of steps to take? Is it clear what I’m missing?
I’ve attached a screenshot of the chrome JS console. I looks like the config database might not be connected to the UI components/ page code?
@leopoldtaylor you should also set the correct permissions to the db.
From your screenshot it looks like the page code cannot find the backend files, you might not copied the config file correctly.
Make sure you have created the files under backend folder with .jsw and not js suffix.
@gal-morad@leopoldtaylor
I had similar issues, but what I did was publish the NSM site. that apparently configured the appropriate databases and pages and enabled the config page to work.
@gal-morad Please can you give me a light how is possible have a database that are automatically synchronized by from WIX and google. I think that a trigger as the clickbutton or something can UPDATE a data in google and not only send a NEW data…
I would like that my database in wix have their data fully updated with google spreedsheet… is possible by Yisrael approach??? Thanks
This is amazing, got the example to work perfectly and just what I needed for my site but…
Would anyone that fully understands how to take this example and implement it on a site be willing to do a video tutorial?
I have a site that already has a multistage form and database but am struggling on the transfer even with @gal-morad@yisrael-wix great work and explanations.
@ctjcoleman Yes great idea! Still having a bunch of trouble myself. If @yisrael-wix or @gal-morad might be able to make a video or screencast on this, that would be amazing! It’ll defo help other people out down the line.
@emaildanielandrada db replication is a complicated issue, even more complex if one side is not a db but a spresdsheet.
I don’t think googlesheet supports an update of existing single line, at least not out of the box, this is a DB action.
You can update lines at wix db.
if your db is very very small you can delete and insert the whole data to the spreadsheet each time. obviously this is not scalable.
Hello, I am having some problems with the “Get Code” button on the form, similarly to @leopoldtaylor , with the Developer console I have witnessed on submitting the Google Sheet URL this error:
I have already tried changing Permission and trying in Live and Preview Mode. Does anyone have any ideas?
This is the site link: https://cogestione2019.wixsite.com/test
Thank you in advance!
Your client configuration field is not correct, you only copied the Client ID. You need to download the Client Configuration and copy the entire contents of the downloaded file into the Client Configuration field.
@yisrael-wix Thank you very much! I was opening the client configuration file with Firefox, but when I tried with Chrome the entire code showed up. Sorted everything out!
Sorry, but the Google APIs are not a part of the Wix Code product (which is what this forum is about). You’ll have to review the Google API documentation to go beyond this simple example.