I'm importing data from one spreadsheet to another one: my formula =QUERY(IMPORTRANGE
is in C9. Everything is working except my script regarding a data validation rule. I want a checkbox to appear in column B any time there is a data in column C.
function onEdit(event) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
// When a client is mentioned in Col3, generate automatically the data validation for the row
var lastRow = s.getLastRow();
if (r.getRow() == lastRow && r.getColumn() == 3){
var rule = SpreadsheetApp.newDataValidation().requireCheckbox().build()
s.getRange(lastRow,2).setDataValidation(rule); // rule to create the check box data validation
}
}
If I add manually content in column C, the script works. But it doesn't work for the imported data. Does anyone have an idea?
Thank you for your help!
Aucun commentaire:
Enregistrer un commentaire