此代碼應該做的是從現在起每週刪除行D6:D13。你能否告訴我它是否按照我的意圖行事。電子表格腳本 - 每個星期日刪除單元格
function myFunction()
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Sheet1");
var currentDate = new Date();
var OneWeekAfter = new Date();
if(OneWeekAfter = currentDate)
{
sheet.deleteCell(D6);
sheet.deleteCell(D7);
sheet.deleteCell(D8);
sheet.deleteCell(D9);
sheet.deleteCell(D10);
sheet.deleteCell(D11);
sheet.deleteCell(D12);
sheet.deleteCell(D13);
oneweekafter.setDate(currentDate.getDate() + 7);
}
}
如果你不確定,你可以自己測試一下。你嘗試過什麼嗎? –