im needing of some advice on how i could get my excel download to the right format. i was wondering if there is any tag that is used in html -> excel download as shown below.
I have declared my excel variables as shown below,
var uri = 'data:application/vnd.ms-excel;base64,'
, tmplWorkbookXML = '<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">'
+ '<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"></DocumentProperties>'
+ '{worksheets}</Workbook>'
, tmplWorksheetXML = '<Worksheet ss:Name="{nameWS}"><Table>{rows}</Table></Worksheet>'
, tmplCellXML = '<Cell><Data ss:Type="{nameType}">{data}</Data></Cell>'
, base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) }
var ctx = "";
var workbookXML = "";
var worksheetsXML = "";
var rowsXML = "";
The logic i came out with to append my data to excel .
for (let i = 0; i < _filterData.length; i++) {
rowsXML += '<Row>'
for (let a = 0; a < _filterData[i].getAppliedValues().length; a++) {
let filtervalue = _filterData[i].getAppliedValues()[a].formattedValue
ctx = {
nameType: 'String',
data: filtervalue
};
rowsXML += format(tmplCellXML, ctx);
}
rowsXML += '</Row>'
}
I am able to download my excel however my excel is not in the format i wanted. image below is how it looks like
The expected result on how the export should look like shown below , in the above script , i am using <'row'> to append my data. how could i swap from vertical insert to horizontal insert. is this possible or the logic should be re-written

Also, i am wondering is it possible to set my column to a certain width size so that when excel has been downloaded , we wont need to stretch the column manually. i believed that i need to make adjustment to my first code snippet. i tried researching online but i couldnt find any information on this as most methods are using third party library, i am not using those due to company restriction. Any approach or resources that i look up to ?