This repository was archived by the owner on Apr 18, 2020. It is now read-only.
This repository was archived by the owner on Apr 18, 2020. It is now read-only.
Data pre-processing #32
Open
Description
In English locales it is common to separate thousands by using a comma ie 1000 -> 1,000, also for readability zeros are replaced with a '-' (see jquery datatables)
If you were to feed either of these numbers into the parser a NaN error would result with warning for end user.
Consider either a global or cell specific (when data type is numeric) processor.
A quick and dirty deals with the global (not ideal as there may be legitimate string uses for ','
function makeXLSXExport(tableId) {
let table = document.querySelector("#"+tableId);
let tableT = table.cloneNode(true);;
tableT.innerHTML = tableT.innerHTML.replace(/,/g,''); //replaces , globally
tableT.innerHTML = tableT.innerHTML.replace(/>-</g,'><'); //replaces cells only containing - globally
TableToExcel.convert(tableT);
}