I currently have the following dataset:
this.set1 // == [111000, 111000, 110000, 110000, 109000]
this.set2 // == [2.073921204, 2.156188965, 2.210624695, 2.210624695, 2.286842346]
this.set3 // == [527.6497192, 522.3652954, 529.675415, 529.675415, 533.8148804]
this.set4 // == [530.6442261, 524.7432861, 532.2295532, 532.2295532, 536.545166]
this.set5 // == [80.73879242, 80.92513275, 80.95175934, 80.95175934, 80.79203796]
I tried the following code to convert this data to my needed CSV data:
// Reference to pulled-data arrays
let data = [
this.set1
this.set2
this.set3
this.set4
this.set5
];
// Convert data arrays to CSV format
const CSVURL = 'data:text/csv;charset=UTF-8,';
let formattedData = data.map(e => e.join(',')).join('\n');
let encodedData = CSVURL + encodeURIComponent(formattedData);
// Generic download CSV function
downloadFile('name.csv', encodedData);
However, this outputted a CSV file of the following format:
How would I convert the data to this format for use in CSV?:
Edit: The similarities to the other post were only partial. See comments for full solution.