Answer the question
In order to leave comments, you need to log in
Move row to new sheet (google spreadsheet)?
Greetings, tell me a macro or script for google spreadsheets (google apps scirpt) so that from a sheet called "1" provided that in cell "D" - the text "financial issue" - the entire line is transferred to the sheet "finance". In the cell itself there will be 5 different conditions, tell me at least with an example so that I can paint further. It is possible even with dubbing on the main page, or with deletion and transfer to another. In general, the whole format will look like, if there is a condition in the cell "d", then transfer it to the "name" sheet, there will be up to 10 such conditions. I
used the following code as an example, but the script is executed, and the actions are 0.
let ss = SpreadsheetApp.getActiveSpreadsheet( );
let zayvkaSheet = ss.getSheetByName('1');
let doSheet = ss.getSheetByName('2');
letcell = e.range;
if (cell.getSheet().getSheetName() === zayvkaSheet.getSheetName()){
if (cell.getValue() === 'text'){
zayvkaSheet.getRange(cell.getRow(), 1, 1, zayvkaSheet.getLastColumn()).copyTo(doSheet.getRange(doSheet.getLastRow() + 1, 1));
zayvkaSheet.deleteRow(cell.getRow());
}
}
}
Answer the question
In order to leave comments, you need to log in
I'll add a little, figured out this code. But there is one nuance to the function (onEdit) - it only performs when there was editing. Since I need this check for the lines that the "google form" automatically sends - and forms the entire text, is it possible to make a function that will check all this not after editing, but when creating a new line, or forming text in it. Well, or just a call through the command.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question