0
谷歌應用程序腳本的一部分我正在通過列值循環並將數據存儲在其位置中。我想從此操作中排除某些行,因爲我不希望這些列中的數據被覆蓋。如何從Google Apps腳本中排除某些列用於循環計算
// save back the values from the editor sheet to the master data sheet
var lookUpTable = ss.getRangeByName("Editor_sheet_template!z_saveback_LookupTableOfCellsAndColumnsToSave");
var sourceCellAddress, sourceCellValue, targetCell, targetCellColumn;
// iterate through all rows in the lookup table
for (var cellRow = 1; cellRow <= lookUpTable.getHeight(); cellRow++) {
// save the value of the editor sheet cell listed in the lookup table to its
// corresponding column on the master data sheet
sourceCellAddress = lookUpTable.getCell(cellRow, /* column */ 1).getValue();
sourceCellValue = editorSheet.getRange(sourceCellAddress).getValue();
targetCellColumn = lookUpTable.getCell(cellRow, /* column */ 2).getValue();
if(targetCellColumn != 'A','D','E'){
Logger.log(targetCellColumn);
targetCell = masterDataSheet.getRange(targetCellRow, targetCellColumn);
targetCell.setValue(sourceCellValue);
}
}