'Exporting the Excel Sheet with correct datatypes via DataTables

I am implementing a customized function to export contents from the second footer row to the Excel sheet because dataTables Api can export only the first footer row. However, I am having troubles since all cell values are changed to 'string' format in the excel sheet, regardless of the original datatype; I'd like float values' datatype as they are in the exported Excel sheet. Could anyone suggest me how to solve this issue?

$('sheetData', sheet).append(append_new_footer_row(footerIndex, array_footerRowCols));

function append_new_footer_row(rowIndex, arr) {
    msg = '<row r="' + rowIndex + '">'
    for (let i = 0; i < arr.length; i++) {
        console.log(parseFloat(arr[i]));
        if (!isNaN(parseFloat(arr[i]))) {
            console.log(typeof parseFloat(arr[i]));
            msg += `<c t="inlineStr" r="' + ${rowIndex} + '" s="2">'
                <is>
                    <t> ${parseFloat(arr[i])} </t>
                </is>   
              </c>`
        }
        else {
            msg += `<c t="inlineStr" r="' + ${rowIndex} + '" s="2">'
                <is>
                    <t> ${arr[i]} </t>
                </is>   
              </c>`
        }

    }
    msg += '</row>';

    return msg;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source