Export data collection with wix code only

Hello !
I am creating a website. I have a database with all data of clients. I am trying to give a user the possibility to click a button and to be able to download the contents of the database in a json or xml or csv file to be able to work with this data in a sql database since wix does not allow to make the joins between the tables.
I managed to create the data json form in a textbox and I want to know how to download the contents of this textbox.
This is a code I use to create json data and put it in a textbox field :
export function btnExport_click(event, $w) {
wixData.query(“ClientProcess”)
.find()
.then( (results) => {
$w(“#textComponent”).value = JSON.stringify(results.items);
} )
. catch ( (err) => {
console.log(err);
} );
}

Thank you in advance for your help.

There is the solution of posting the content of an html element (like a div or other) to a php page that can later write to an already existing file on the user’s C: drive but unfortunately wix does not allow to embed php pages. Well I think.

Hi,
You can view this article of How to Import and Export Collection Data Using the wix-data API.

Good luck!
Tal.

Hi Tal,
Thank u for your response.
What I am looking for is to be able to click on a button to make a download of my JSON file like that i can transform it into xlsx and can work with excel.
I managed to put the contents of my collection as a JSON file and put the result in a textbox or in a html block but I do not know how to export this result outside of wix by doing for example a download.
Regards.
Thomas.

While this article is good, like Thomas writes… most users do not know JSON while most everyone knows XCEL. Since you now support (and have been for a good while) CSV importing and exporting at the dashboard level, is there any plans to update the API to allow creation of a CSV file?

Thanks
JD

Did you ever get a solution?
Thanks
JD

try this:
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-google-sheets-npm