Skip to content

Instantly share code, notes, and snippets.

@jesusalber1
Last active February 20, 2023 16:52
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jesusalber1/c995ff11bcf7cff6afbce385ade60441 to your computer and use it in GitHub Desktop.
Save jesusalber1/c995ff11bcf7cff6afbce385ade60441 to your computer and use it in GitHub Desktop.
[Google Scripts] Replace commas with dots in Google Spreadsheets
function replaceCommasDots() {
var id = ''; /* Your spreadsheet id (value after /id/*): https://docs.google.com/spreadsheets/d/:id/edit */
var sheet = SpreadsheetApp.openById(id);
var range = sheet.getRange("A1:B2"); /* range you want to modify */
var data = range.getValues();
for (var row = 0; row < data.length; row++) {
for (var col = 0; col < data[row].length; col++) {
data[row][col] = (data[row][col]).toString().replace(/,/g, '.');
}
}
range.setValues(data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment