Faced such a problem: Google forms, when saving data to a table, change in numbers the decimal separator from “comma” to “point”. As a result, instead of numbers in the table we have the text. Now I change the “point” to “comma” in the columns manually via “Menu-Edit-Find and Replace”. But I would like to automate this. According to various examples from the Internet, I wrote the following:
function onOpen() { var sheet = SpreadsheetApp.getActiveSpreadsheet(); var entries = [{name : "Замена точки на запятую",functionName : "ReplaceDotToComma"}]; sheet.addMenu("Скрипты", entries); }; function ReplaceDotToComma() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName("Страница 2") var r = sheet.getRange("A:B"); var rws = r.getNumRows(); var cls = r.getNumColumns(); var i, j, a, fnd, rpl; fnd = "."; rpl = ","; for (i=1;i<=rws;i++) { for (j=1;j<=cls;j++) { a=r.getCell(i, j); a=a.toString().replace(fnd, rpl); r.getCell(i, j).setValue(a); } } } But something is not working. Please help, how to write a replacement command? Ready for any help. Thanks in advance.