Answer the question
In order to leave comments, you need to log in
How to make a script that checks the conditions and runs the corresponding functions?
You need to make a button that will check, for example, if the value in the cell is> 0.1, then a specific function will be performed.
There are 50 lines in total, each line has its own function that simply transfers data from this line to the table, there can be several matches to the condition, and for each condition fulfilled, you need to run the corresponding line function.
It looks something like this:
function getLastRow(sheet, rangeString) {
var rng = sheet.getRange(rangeString).getValues();
var lrIndex;
for (var i = rng.length - 1; i >= 0; i--) {
lrIndex = i;
if (
!rng[i].every(function(c) {
return c == '';
})
) {
break;
}
}
return lrIndex + 1;
}
function Func1() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lr = getLastRow(ss, 'K1:N155');
var values = ss.getRange(5, 6, 1, 4).getValues();
var values = ss.getRange(lr + 1, 11, 1, 4).setValues(values);
var clear = ss
.getRange(5, 6, 1, 4)
.clear({ fomartOnly: true, contentsOnly: true });
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question