You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a custom component in Angular5 application named data-graph component. In that custom component i received data which i am exporting to Csv using Angular5Csv angular package which is downloading instantly on button click correctly. Here is that clicked function code from data-graph.component.ts
import { Angular5Csv } from 'angular5-csv/dist/Angular5-csv' exportToCsv() { let fileName = this.sensors[0].meter.name + 'Sensors Report'; this.sensorsData.map(item => { if (item._id) { delete item._id; } item.Time = new Date(item.date).toLocaleString(); delete item.date; }) this.customData = this.sensorsData; let fields = Object.keys(this.customData[0]); var options = { fieldSeparator: ',', decimalseparator: '.', title: '', showLabels: true, showTitle: true, noDownload: false, headers: fields, }; new Angular5Csv(this.customData, fileName, options); let anotherCsv = new Angular5Csv(this.customData, fileName, options); }
This exports a csv with data and headers very correctly in this format :
I have a custom component in
Angular5
application nameddata-graph
component. In that custom component i received data which i am exporting to Csv usingAngular5Csv
angular package which is downloading instantly on button click correctly. Here is that clicked function code fromdata-graph.component.ts
import { Angular5Csv } from 'angular5-csv/dist/Angular5-csv'
exportToCsv() { let fileName = this.sensors[0].meter.name + 'Sensors Report'; this.sensorsData.map(item => { if (item._id) { delete item._id; } item.Time = new Date(item.date).toLocaleString(); delete item.date; }) this.customData = this.sensorsData; let fields = Object.keys(this.customData[0]); var options = { fieldSeparator: ',', decimalseparator: '.', title: '', showLabels: true, showTitle: true, noDownload: false, headers: fields, }; new Angular5Csv(this.customData, fileName, options); let anotherCsv = new Angular5Csv(this.customData, fileName, options); }
This exports a csv with data and headers very correctly in this format :
But i want to add another header with one row like this :
How can i achieve this result using
angular5Csv
?The text was updated successfully, but these errors were encountered: