We're trying to replace all Diacritics in a sheet with their more database-friendly counterparts. I want to be able to apply the solution found here (Remove accents/diacritics in a string in JavaScript) to an Array.
We've already visited the topic on "Remove accents/diacritics in a string in Javascript" and the solution works great for one cell. However, when I try to do it with my current code, it only changes one value and pastes it to the whole array. What am I doing wrong?
(Rest of code is visible in link)
function removeDiacritics () {
var range = "A2:B3";
var array = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Cleaner").getRange(range).getValues();
var base = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Cleaner").getRange(range);
var newArray = [];
for(var row=0;row<array.length;row++){
for(var i=0;row<array[row].length;i++){
var newText = array[row][i].replace(/[^\u0000-\u007E]/g, function(a){
return diacriticsMap[a] || a;
});
newArray.push(newText);
}
}
base.setValue(newArray);
}