Exporting data automatically

Hi,

I have a page with a few user inputs box and all the user inputs are collected to a database collection on a submit button. I would like to have the data exported automatically to an external source in addition to having it on Wix databse. Doesn’t matter whether it is a online spreadsheet like Google Sheet or a file like Excel.

What would be the easiest way (or least amount of coding involved) to do that?
Would it be easier to do it on the page and have data send to external source on the submit button? Or would it be easier to do it on the backend and have data send to the external source from the Wix database collection?

Thank you!

Hi Justin,

The only idea I have to achieve what you want is to make a POST request using wixFetch with all the data you want to export to any third party source you wish.
Note that for security reasons it is better to create the fetch function in your backend code and then run it in the frontend, as you can see how to do here

Good luck!

  • Lior

I would get Zapier and using fetch to send all your data to Zapier and then to any excel or google sheet you would like to use.

I use this solution in more than 5 projects now and it works like a charm.

If you want to schedule the export just make a function in a http-functions file that you hit by using some free cron service online like easycron.com or similar and then do your export in that function. Then you also get it scheduled.

Otherwise add your code in a data hook like after_insert and then your sheet will be updated just seconds after your data has been inserted into your Data Collection.

1 Like