i am trying to create a csv and succeeded in that except with a new column has been added from the second line , [![enter image description here][1]][1] The following is the lwc code .` exportToCSV() { ****/* Row 1 :Staic HEADER */**** let s; s =["Name","Example Data","Field Type","Data Category","Data Category Definition","Data Classification"]; /* Row 1 : Dynamic Headers Continuation to Static Headers */ for(let d in this.columnHeaderLists1){ s.push("\"" + this.columnHeaderLists1[d] + "\""); } s.push("\n"); ****/* Row 2 : Dynamic second Headers */**** **Here I need 6 spaces but pushing 5 empty strings (Due to empty Column created)** s.push("","","","",""); for(let key in this.columnHeaderList){ let t; t = this.columnHeaderList[key].subcolumn; for(let key in t){ s.push("\"" + t[key] + "\""); } } s.push("\n"); } console.log('s:',s); let columnHeader = s; **/* I'm not using the belowc code , which requires a pojo*/ /* Our code has data from multiple queries so , it is complex to add a pojo and utilize the below code */** let jsonKeys = []; //"name","exampleData","fieldType","category","categoryDefinition","classification"]; var jsonRecordsData = []; console.log('length ',jsonRecordsData.length); let csvIterativeData; let csvSeperator let newLineCharacter; csvSeperator = ","; newLineCharacter = "\n"; // csvIterativeData = ""; csvIterativeData += columnHeader.join(csvSeperator); csvIterativeData += newLineCharacter; for (let i = 0; i < jsonRecordsData.length; i++) { let counter = 0; for (let iteratorObj in jsonKeys) { let dataKey = jsonKeys[iteratorObj]; if (counter > 0) { csvIterativeData += csvSeperator; } if ( jsonRecordsData[i][dataKey] !== null && jsonRecordsData[i][dataKey] !== undefined ) { csvIterativeData += '"' + jsonRecordsData[i][dataKey] + '"'; } else { csvIterativeData += '""'; } counter++; } csvIterativeData += newLineCharacter; } console.log("csvIterativeData", csvIterativeData); this.hrefdata = "data:text/csv;charset=utf-8," + encodeURI(csvIterativeData); } }` Is that a right approach using nested if's to handle different csv header . [1]: https://i.sstatic.net/bdCJw.png