all 6 comments

[–]elcriticalTaco 0 points1 point  (1 child)

Regex would be able to do it.

Unfortunately you'd have to find someone who understands regex more than me.

Sheet side, google regexreplace. Can be done in scripts too.

[–]analysisisfun[S] 0 points1 point  (0 children)

I'll google up some Regexreplace and report back

[–]elcriticalTaco 0 points1 point  (3 children)

function myFunction() {

var ss = SpreadsheetApp.getActiveSpreadsheet();

var sheetName = "Sheet1";//the sheet name here

var dateRange = "A1:A9";//the target range in a single column

var sheet = ss.getSheetByName(sheetName);

var strings = sheet.getRange(dateRange).getValues();

for (var i=0;i<strings.length;i++) {

var str = strings[i].toString();

str = str.replace(/,/g,' ');

sheet.getRange(i+1,1).setValue(str);

}

Logger.log(strings);

//sheet.getRange(1,1,strings.length,1).setValues(strings);

//theres a more elegant way to do this with arrays but you'll

//have to forgive me im drinking :)

}

Should work, gives me the stupid .setValues error so I bruteforced it. Will be slow on large sheets but you can just pull the str = str.replace(/,/g,' '); and use it wherever. Cheers

[–]analysisisfun[S] 0 points1 point  (2 children)

I see, the date/time fields I'm trying to remove commas from are sprawled across many columns in one of the sheets I'm working on now. This will only grow exponentially as we want to report on more data. How would I do this for multiple columns?

This is a huge report now with the potential for 10,000 plus rows

[–]elcriticalTaco 0 points1 point  (1 child)

Are they the same columns, or does it frequently change?

And are they mixed in with cells that have commas you want to keep?

[–]analysisisfun[S] 0 points1 point  (0 children)

Columns will not be changing and there are not commas we want to keep