我有一个多维数组,它基于电子表格中的数据。它的结构如下:Array[0][row][column]
。
现在我想检查一列中多行的值是否为空。有没有办法简洁地表达像if (Array[0][Row 1 to 10][Column 3] === "")
这样的东西?
这是我目前的代码:
function updateOverview() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var database = SpreadsheetApp.openById('XYZ');
var overviewContent = [ss.getDataRange().getValues()];
var campaignData = [database.getDataRange().getValues()];
for (var a = 1; a < (campaignData[0].length); a++) {
for (var d = 4; d < overviewContent[0].length; d++) {
if (campaignData[0][a][3] === overviewContent[0][0][1] && (Utilities.formatDate(campaignData[0][a][7],"GMT+01:00","yyyyMMdd")) <= (Utilities.formatDate(overviewContent[0][d][3],"GMT+01:00","yyyyMMdd")) && (Utilities.formatDate(campaignData[0][a][8],"GMT+01:00","yyyyMMdd")) >= (Utilities.formatDate(overviewContent[0][d][3],"GMT+01:00","yyyyMMdd"))) {
var campaignDuration = (Utilities.formatDate(campaignData[0][a][8],"GMT+01:00","yyyyMMdd") - Utilities.formatDate(campaignData[0][a][7],"GMT+01:00","yyyyMMdd"));
var campaignSlotAvailable = true;
for (var b = d; b < (campaignDuration +1); b++) {
if (overviewContent[0][b][5] !== "") {
campaignSlotAvailable = false;
break;
}
}
if (campaignSlotAvailable) {
overviewContent[0][d][5] === campaignData[0][a][6];
}
}
}
};
ss.getDataRange().setValues(overviewContent[0]);
};