Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 添加日期筛选器会阻止我访问其他工作表中的范围_Google Apps Script_Google Sheets_Google Sheets Api - Fatal编程技术网

Google apps script 添加日期筛选器会阻止我访问其他工作表中的范围

Google apps script 添加日期筛选器会阻止我访问其他工作表中的范围,google-apps-script,google-sheets,google-sheets-api,Google Apps Script,Google Sheets,Google Sheets Api,在我运行这个代码之后 function _filterDates(){ var criteria = SpreadsheetApp.newFilterCriteria() .whenDateBefore(SpreadsheetApp.RelativeDate.YESTERDAY) .whenDateAfter(new Date(mailTab.getRange('P9').getValue())) .build(); draftTab.getFilter().setCol

在我运行这个代码之后

function _filterDates(){
  var criteria = SpreadsheetApp.newFilterCriteria()
  .whenDateBefore(SpreadsheetApp.RelativeDate.YESTERDAY)
  .whenDateAfter(new Date(mailTab.getRange('P9').getValue()))
  .build();  
  draftTab.getFilter().setColumnFilterCriteria(1, criteria);
}
如果我尝试访问其他工作表中的一些数据,我会得到以下错误:

var hasNewData = mailTab.getRange('AB6').getValue() == "NEW";
错误:

Exception: This operation is not supported on a range with a filtered out row.
试试这个。由于GoogleSheet需要在添加新过滤器之前删除现有过滤器,您可以执行手动添加新过滤器,您会注意到它