有没有办法让Google表格每天默认使用其他标签? [英] Is there a way to get Google Sheets to default to a different tab each day?

查看:196
本文介绍了有没有办法让Google表格每天默认使用其他标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MVC应用程序,该应用程序通过Siteloader链接到Google表格文档.加载效果很好,但默认情况下会加载工作表中的第一个标签-显然按设计工作.

I have an MVC application that links to a Google Sheet doc via siteloader. It's loading great but defaulting to load the first tab in the sheets - working as designed obviously.

这是我需要做的:

此工作表中的选项卡按日期分隔.例如,今天是8/22/20.该选项卡显示"SAT 082220".明天的标签为"SUN 082320&".等等.

The tabs in this sheet are separated by date. So, for example, today's 8/22/20. The tab displays "SAT 082220." Tomorrow's tab will be "SUN 082320" and so on.

项目加载时,我需要Siteloader默认为今天的标签.因此,基本上,它只需要每天加载列表中的下一个标签即可.

I need siteloader to default to today's tab when the project loads. So basically it just needs to load the next tab in the list each day.

有人对如何做到这一点有任何想法吗?

Does anyone have any thoughts on how to accomplish this?

我知道Google表格通过URL中的edit#gid =为表格中的每个标签分配了自己的唯一URL.

I know Google Sheets assigns its own unique URL to each tab in the sheet via the edit#gid= in the URL.

标签页网址是否有模式,这样我就可以让Siteloader每天不断加载列表中的下一个标签页?即为今天的标签页编辑#gid = 1068387962,为明天的标签页编辑#gid =某物?

Is there a pattern to the tab URL so I could have siteloader constantly just load the next tab in the list each day? i.e. edit#gid=1068387962 for today's tab and edit#gid=somethingsomething for tomorrow's?

我认为这可能是最简单的方法.但从我所看到的来看,这一切看起来都是随机的.

I'm thinking that may be the easiest way. From what I can see, though, it all looks random.

或者,有没有办法让剃刀读取选项卡并使选项卡名称与 DateTime.now 匹配?

Alternatively, is there a way to get razor to read the tabs and match the tab name with DateTime.now?

推荐答案

<应用程序脚本上的code> onOpen 触发器可以执行以下操作:

onOpen trigger on apps script can do this:

/**
 * @param {GoogleAppsScript.Events.SheetsOnOpen} e
 */
const onOpen = e =>
  e.source
    .getSheetByName(
      Utilities.formatDate(
        new Date(),
        e.source.getSpreadsheetTimeZone(),
        'EEE MMddyy'
      ).toUpperCase()
    )
    .activate();

这篇关于有没有办法让Google表格每天默认使用其他标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆