You can use AlaSQL.js library to export data locally in CSV (and XLSX as well) file format. Below you can see a simple working example how to export data to CSV format.