Export db to excel doesn't work

Hi all…

I am trying to export a db to excel file but when opening in excel it says that the file is not supported. When opening in Google Sheets it says the file is corrupted.

Here is the wix code on the button:

export function exportToExcel_click(event) {
 let dataCollectionName = "contact02";
    wixData.query(dataCollectionName)
    .find()
    .then((results) => {
 if (results.totalCount > 0) {
 let items = results.items;
            $w("#html1").postMessage(items);
        }
    })
}

And here is the “html1” code embedded in the page:

Anyone can help please…?
Thank you and have a great day.

Sorry, but adding code to an HTML component is not a part of the Corvid product (which is what this forum is about). You will need to check with the author or service provider of the script to find out how to get it work.

Thank you.
Is there a way to export a db to excel by clicking on a button in the page - using corvid?

You might try out the technique in this post:
How to download the contents of a data collection in a csv file

You might also be able to use one of the libraries in the Package Manager to build your CSV file:

Thank you.

here is a new tutorial: