Can some one help me with the following scenario, I am constructing and downloading a csv file using javascript.
The CSV file should look like this.
1. Column1 Column2 Column3
2. aaaaaa xxxxxxx rrrrrr
3. bbbbbb ccccccc dddddd
*Note: This long statement i, want it to be single statement by merging, of columns.Instead of these statements splitted into columns.
The problem is, the last line(*Note) is getting splitter into columns since it holds commas(','). Any Help or suggestion will do help me a lot
Following is the Code:
var csvRow = [];
csvRow.push('Column1','Column2','Column3');
csvRow.push('aaaaaaa','bbbbbbb','cccccccc');
csvRow.push('xxxxxxxx','yyyyyyy','zzzzzzzzz');
csvRow.push('*Note: This long statement i, want it to be single statement by merging, of columns.Instead of these statements splitted into columns.');
var csvString = csvRow.join("\r\n");
var a = document.createElement('a');
a.href = 'data:application/csv;charset=utf-8,' + encodeURIComponent(csvString);
a.target = '_blank';
a.download = 'SampleCSV.csv';
document.body.appendChild(a);
a.click();