Skip to content

Instantly share code, notes, and snippets.

@volandku
Last active June 19, 2020 18:19
Show Gist options
  • Save volandku/6b02a49eabde8107b1d5fe8ddaa6c4ac to your computer and use it in GitHub Desktop.
Save volandku/6b02a49eabde8107b1d5fe8ddaa6c4ac to your computer and use it in GitHub Desktop.
Google Sheet замена текста в ячейках
/** @OnlyCurrentDoc */
function ChangeIt()
{
var sheet = SpreadsheetApp.getActiveSheet();
//var cell = sheet.getRange('A1:D7');
var cell =sheet.getDataRange();
cell.setValues(cell.getValues().map(blackBox_));
}
function blackBox_(row){
return row.map(blackFox2_);
}
function blackFox2_(cell)
{
console.log(cell);
if (typeof cell.replace === "function") { return cell.replace("Да (часто)","2").replace("Иногда (частично)","1").replace("Нет (никогда)","0");}
else { return cell;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment