Hey there!
There is a lot of people that have been asking how can we export data from our Data Collections to a real MS Excel file. You can export data inside the data manager as CSV and then open that in MS Excel.
But if you want this function for your clients / site visitors it hasn't been that easy right?
I have found out that there is actually a really simple way to do this. MS Excel will parse any HTML formatted table with table rows and table cells as columns and cells. So what I did was to test if I could find code snippets to create tables from JSON formatted data and I did.
Then I managed to make some code to actually export that HTML table to a file that the browser will think is a pure MS Excel file.
The only thing you will need is a Data Collection to use, a button that someone will click on and a hidden html component with some code inside. That's it! It seem to work really well from my testing.
So watch the video I just made for you all and download the source code for your HTML Component at the button of this post. I hope you will enjoy this, any feedback is greatly appreciated from you all.
Code for HTML Component can be found here:
https://github.com/andreaskviby/wixhtmlpages/blob/master/docs/wix-datacollection-excel-export.html
#htmlcomponent #msexcel #excel #datacollection #button #export
Hi @laurens.vandamme,
To just show a few columns, you can use a hash map in Javascript within Corvid:
if (results.totalCount > 0) { let items = results.items; items = items.map(function(obj){ return {email: obj.email, username: obj.username}; //only shows the columns that you want }); $w("#html1").postMessage(items); }
@Andreas Kviby Is there a way to just export a few columns to excel? Because now I get also the columns of the ID and Creation Date etc. Also does this code work for .xlsx too?
Thanks a lot!
This is awesome! Thank you for sharing.
Do you know how to take data from a site and push it into a pdf document?