如何获得带有Google脚本的特定工作表的链接? [英] How could I get the link of an specific sheet with Google script?
问题描述
我有一个包含许多工作表的电子表格.每个工作表都是一个报告,并具有不同的链接.如何获得此活动表的链接?
I have a spreadsheet with many sheets. Each sheet is a report and has a different link. How could I get the link of this active sheet?
例如:输出>报告的链接在此处可用.
Eg: Output > The link of the report is available here.
推荐答案
您的此处"链接无效,但是,可以创建指向特定工作表的公共超链接.
Your 'here' link doesn't work, however, in lieu of that, it is possible to create a public hyperlink to a specific sheet.
打开Google表格并在浏览器中浏览表格时,您会注意到URL的锚元素为#gid = some_number.
When you open the Google Sheet and navigate the sheets in your browser, you will notice that there is an anchor element to the URL that is #gid=some_number .
将相同的#gid = some_number片段附加到电子表格所具有的任何超链接中,将直接链接到该工作表.
Appending that same #gid=some_number piece to any hyperlink you have for the spreadsheet will link directly to that sheet.
如果您是使用脚本以编程方式生成工作表的,因此事先不知道向导,那么您将需要使用
If you are generating the sheets programmatically using a script, so don't know the gid in advance, then you will need to use the getSheetID function in your Google Script
这篇关于如何获得带有Google脚本的特定工作表的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!