链接到 Google 个工作表中的另一个标签
Linking to another tab in Google Sheets
我有一个 Google 表格工作簿,其中有 70 多个标签或 sheet 个。在其中一个中,我有所有这些的主列表。为了更好地参考,在选项卡 "PropertyID" 和 F 列中,从 2 开始,我在工作簿中有彼此的名字 sheet。我想找到一种方法将 hyperlink 每个 sheet 放入 PropertyID 选项卡,这样如果有人在这个主 "menu" 中按 link,它会带他们到具体 sheet。到目前为止,我一直在对每个 sheet 进行评论,并使用 "Link to comment" link 来做我想做的事情,但是这个过程很繁琐,必须手动完成,如果我必须将工作簿下载到 excel 以便于编辑,然后返回 sheets,所有评论都变成 'notes' 而 links 丢失了。我有什么办法可以做到这一点?
这里有一个 forum 与您的问题类似。
When you switch to a different sheet in Google Spreadsheets, pay attention to the URL in your browser's address bar. At the end of the URL you should see something like:
#gid=0
This number changes when you switch sheets, and specifies which sheet to display. Copy the entire URL and create a hyperlink to it with this formula:
=hyperlink("https://docs.google.com/spreadsheet/ccc?key=0AsaQpHJE_LShcDJ0dWNudHFZWVJqS1dvb3FLWkVrS0E#gid=0", "LINK TEXT")
您还可以在上面提供的 link 中看到如何使用脚本进行操作。 "This menu item will open a panel with a list of names of all the sheets in the current spreadsheet. It doesn't look like it, but if you click on one of the sheet names, that sheet will come to the front."
这是一个可能也有帮助的相关话题:
希望对您有所帮助!
Google 表格现在正式支持非公式 hyperlinks,因此您现在有两种方法可以做到这一点。
手动方式:select一个单元格,插入一个link(插入>插入Link或Ctrl+K),并添加一个link 到目标 sheet #gid=<sheet id>
。与 HYPERLINK 公式不同,sheet 将在当前选项卡中打开。
自动方式:创建脚本(工具 > 脚本编辑器)并使用 setLinkUrl()
到 link 到 sheet。
例如,以下函数从第 2 行开始遍历 sheet“Foo”A 列中的所有单元格,并根据该行的文本分配 links。
function linkRange() {
const startRow = 2, // Start at the second row.
column = 1; // Add links to column A.
const spreadsheet = SpreadsheetApp.getActive(),
sheet = spreadsheet.getSheetByName("Foo"),
lastRow = sheet.getLastRow();
for (let row = startRow; row <= lastRow; row++) {
const range = sheet.getRange(row, column),
richTextValue = range.getRichTextValue(),
targetSheet = spreadsheet.getSheetByName(richTextValue.getText());
if (targetSheet !== null) {
const sheetId = targetSheet.getSheetId(),
builder = richTextValue.copy().setLinkUrl(`#gid=${sheetId}`);
range.setRichTextValue(builder.build());
}
}
}
请注意,它将丢弃该列中现有的 link 和公式。
这个怎么样: 来自我的分析器 sheet,它提供了许多演示文稿 sheets。
如果 sheet 是动态的 created/inserted,您可以自动插入 #gid。
编辑 1 Sheet ref 可以减少为#gid;添加过滤器
=ArrayFormula(
SORT(
FILTER(
HYPERLINK("#gid="&Analyser!H4:H,Analyser!G4:G),Analyser!H4:H>0)
)
)
我有一个 Google 表格工作簿,其中有 70 多个标签或 sheet 个。在其中一个中,我有所有这些的主列表。为了更好地参考,在选项卡 "PropertyID" 和 F 列中,从 2 开始,我在工作簿中有彼此的名字 sheet。我想找到一种方法将 hyperlink 每个 sheet 放入 PropertyID 选项卡,这样如果有人在这个主 "menu" 中按 link,它会带他们到具体 sheet。到目前为止,我一直在对每个 sheet 进行评论,并使用 "Link to comment" link 来做我想做的事情,但是这个过程很繁琐,必须手动完成,如果我必须将工作簿下载到 excel 以便于编辑,然后返回 sheets,所有评论都变成 'notes' 而 links 丢失了。我有什么办法可以做到这一点?
这里有一个 forum 与您的问题类似。
When you switch to a different sheet in Google Spreadsheets, pay attention to the URL in your browser's address bar. At the end of the URL you should see something like:
#gid=0
This number changes when you switch sheets, and specifies which sheet to display. Copy the entire URL and create a hyperlink to it with this formula:
=hyperlink("https://docs.google.com/spreadsheet/ccc?key=0AsaQpHJE_LShcDJ0dWNudHFZWVJqS1dvb3FLWkVrS0E#gid=0", "LINK TEXT")
您还可以在上面提供的 link 中看到如何使用脚本进行操作。 "This menu item will open a panel with a list of names of all the sheets in the current spreadsheet. It doesn't look like it, but if you click on one of the sheet names, that sheet will come to the front."
这是一个可能也有帮助的相关话题:
希望对您有所帮助!
Google 表格现在正式支持非公式 hyperlinks,因此您现在有两种方法可以做到这一点。
手动方式:select一个单元格,插入一个link(插入>插入Link或Ctrl+K),并添加一个link 到目标 sheet
#gid=<sheet id>
。与 HYPERLINK 公式不同,sheet 将在当前选项卡中打开。自动方式:创建脚本(工具 > 脚本编辑器)并使用
setLinkUrl()
到 link 到 sheet。
例如,以下函数从第 2 行开始遍历 sheet“Foo”A 列中的所有单元格,并根据该行的文本分配 links。function linkRange() { const startRow = 2, // Start at the second row. column = 1; // Add links to column A. const spreadsheet = SpreadsheetApp.getActive(), sheet = spreadsheet.getSheetByName("Foo"), lastRow = sheet.getLastRow(); for (let row = startRow; row <= lastRow; row++) { const range = sheet.getRange(row, column), richTextValue = range.getRichTextValue(), targetSheet = spreadsheet.getSheetByName(richTextValue.getText()); if (targetSheet !== null) { const sheetId = targetSheet.getSheetId(), builder = richTextValue.copy().setLinkUrl(`#gid=${sheetId}`); range.setRichTextValue(builder.build()); } } }
请注意,它将丢弃该列中现有的 link 和公式。
这个怎么样:
如果 sheet 是动态的 created/inserted,您可以自动插入 #gid。
编辑 1 Sheet ref 可以减少为#gid;添加过滤器
=ArrayFormula(
SORT(
FILTER(
HYPERLINK("#gid="&Analyser!H4:H,Analyser!G4:G),Analyser!H4:H>0)
)
)