如何在不创建任何新列的情况下将输入到每个单元格的文本自动附加到同一个根 URL?
How can I have the text I enter into each cell automatically appended to the same root URL without creating any new columns?
我正在改写我原来的问题以使其更容易理解。
我在下面的“https”之间放置了空格,因为 Whosebug 不允许我输入实际的 URL。
当然,我可以在单元格 A1 中输入文本“apple”,然后从 A1 到 foo.com/Apple
添加一个 link,这样我就可以得到 [Apple](h t t p s:// foo.com/Apple) 在 A1 中。但是,我希望自动完成。
换句话说,我想...
- 转到一个单元格,然后
- 在我的键盘上输入“apple”,然后
- 按回车键,然后
- 我不想只看到纯文本的“apple”,实际上我想看到
- “apple”超级link像这样
foo.com/Apple
[Apple](h t t p s://foo.com/Apple).
尝试:
=INDEX("foo.com/"&B2:B3)
要得到你想要的,你可以使用 Google Apps Script。添加一个每次编辑 A 列时都会触发的触发器,获取输入的值并将其与 =HYPERLINK(url, link_label)
函数结合使用,应该可以满足您的需求。
- 打开 Google Apps 脚本编辑器,
Tools>Script Editor
- 添加以下代码
function onEdit(e) {
// Check the edit is in column A
if(e.range.getColumn()==1){
// Get the values from the onEdit
let cell = e.range.getA1Notation()
let value = e.value
let ss = e.source
// Adding as HYPERLINK Formulas
ss.getRange(cell)
.setFormula(`=HYPERLINK("https://example.com/${value}","${value}")`)
}
}
文档
我正在改写我原来的问题以使其更容易理解。
我在下面的“https”之间放置了空格,因为 Whosebug 不允许我输入实际的 URL。
当然,我可以在单元格 A1 中输入文本“apple”,然后从 A1 到 foo.com/Apple
添加一个 link,这样我就可以得到 [Apple](h t t p s:// foo.com/Apple) 在 A1 中。但是,我希望自动完成。
换句话说,我想...
- 转到一个单元格,然后
- 在我的键盘上输入“apple”,然后
- 按回车键,然后
- 我不想只看到纯文本的“apple”,实际上我想看到
- “apple”超级link像这样
foo.com/Apple
[Apple](h t t p s://foo.com/Apple).
尝试:
=INDEX("foo.com/"&B2:B3)
要得到你想要的,你可以使用 Google Apps Script。添加一个每次编辑 A 列时都会触发的触发器,获取输入的值并将其与 =HYPERLINK(url, link_label)
函数结合使用,应该可以满足您的需求。
- 打开 Google Apps 脚本编辑器,
Tools>Script Editor
- 添加以下代码
function onEdit(e) {
// Check the edit is in column A
if(e.range.getColumn()==1){
// Get the values from the onEdit
let cell = e.range.getA1Notation()
let value = e.value
let ss = e.source
// Adding as HYPERLINK Formulas
ss.getRange(cell)
.setFormula(`=HYPERLINK("https://example.com/${value}","${value}")`)
}
}