【问题标题】:Find sheet by name with tomorrow's date in Google Sheets在 Google 表格中按名称查找包含明天日期的表格
【发布时间】:2019-10-07 16:35:03
【问题描述】:

我在 Google 表格中有一个工作表,其中有很多表格,每个表格代表一天 - 以“dd/MM/yy ddd”格式命名。

我需要一个每天在特定时间触发的函数,寻找明天的工作表以将数据复制到另一个工作表。

【问题讨论】:

标签: google-apps-script google-sheets


【解决方案1】:

为 SheetName 试试这个:

function getTomorrowsSheetName() {
  var today=new Date();
  //Logger.log(Utilities.formatDate(new Date(today.getFullYear(),today.getMonth(),today.getDate()+1), Session.getScriptTimeZone(), "dd/MM/yy E"));
  return Utilities.formatDate(new Date(today.getFullYear(),today.getMonth(),today.getDate()+1), Session.getScriptTimeZone(), "dd/MM/yy E");
}

然后使用

var ss=SpreadsheetApp.getActive();
var sh=ss.getSheetByName(getTomorrowsSheetName());

Utilities.formatDate()

Javascript Date() Reference

Simple Date Format

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-02
    • 1970-01-01
    • 2022-01-19
    • 1970-01-01
    • 2013-12-07
    • 1970-01-01
    • 2022-01-18
    相关资源
    最近更新 更多