I have a table that I generate from BLOB html stored in a database. I have managed to export the table generated to excel and pdf, now I need the same table in csv. Have tried to research but all am getting is passing json and generating the csv, but I want to just pass the table ID and export to CSV.
What I have done for excel.
exportexcel(): void {
/* table id is passed over here */
let element = document.getElementById('htmlData');
const ws: XLSX.WorkSheet =XLSX.utils.table_to_sheet(element);
/* generate workbook and add the worksheet */
const wb: XLSX.WorkBook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
/* save to file */
XLSX.writeFile(wb, this.fileName);
}
How can I achieve the same by passing let element = document.getElementById('htmlData'); and export it to csv. I don't want to go through the option of mat-table-exporter. Thank you in advance