我是 Google Apps 脚本的新手,需要一些帮助来弄清楚如何编写我的电子表格。电子表格由提交表单的用户填充。我希望行颜色根据某一列的响应而改变。这是我到目前为止所拥有的:
function colorRow(){
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Requests");
var range = sheet.getDataRange();
// will get the row
var row = range.getRow();
// get the cell value to compare
var cellValue = range.getValue()
if(cellValue == "Cancel Interpreter Request"){
dataRange.setBackgroundRGB(255, 0, 0);
}
else if(cellValue == "Next Day Interpreter Request"){
dataRange.setBackgroundRGB(201, 218, 248);
}
else if(cellValue == "Update Existing Interpreter Request"){
dataRange.setBackgroundRGB(255, 255, 0);
}
else if(cellValue == "Same Day Request"){
dataRange.setBackgroundRGB(106, 168, 79);
}
SpreadsheetApp.flush();
}
function onSubmit(e){
colorRow();
}
有任何想法吗?