在Google电子表格中使图片可点击 [英] make image clickable in google spreadsheet

查看:242
本文介绍了在Google电子表格中使图片可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将可导入的图片点击进Google电子表格。
当我点击它带我到另一个网站。

我能够:
- 将图像
- 插入到'分配脚本'
- 看起来像这样:

$ p $ function $ show b
$ b浏览器。 msgBox('您点击了!');
}

当我点击图片时,出现上面的消息。然而,我需要一个脚本,我可以分配并点击图片时打开外部URL。



是否有这样的脚本可用?

解决方案

这些是我能够想到的两个解决方案:



(1)将此脚本分配给您的图像,并用您自己的链接替换链接。它需要多一个用户点击,但它可能是你能做的最好的。 Caja锁定HTML服务输出的所有内容非常紧密,所以像 window.location.replace(http://www.example.com); window.location.href =http://www.example.com; 是不行的。

  function redirectTest(){
var htmlOutput = HtmlService
.createHtmlOutput('< a href =http://www.example.com> Click me! < / a>')
.setWidth(100)
.setHeight(100);
SpreadsheetApp.getUi()。showModelessDialog(htmlOutput,); (2)根据>

google.com/forum/#!topic/docs/BjnpMxEdbcIrel =nofollow noreferrer> this source and 这个来源,以下公式应该可以工作:

  = HYPERLINK(http://www.example.com,IMAGE(https://www.google.com/images/srpr/logo11w.png))

我无法在测试中使用它,但源代码并不旧。


I try to make clickable an imported image into Google spreadsheet. When I click it to take me to another website.

I was able to: - insert the image - to 'Assign script' to it - that looks like this:

function showMessageBox() {
  Browser.msgBox('You clicked it!');
}

When I click the image the above message comes up. However I need a script that I can assign and opens an outside url when image clicked.

Is there such a script available?

解决方案

These are the two solutions I was able to come up with:

(1) Assign this script to your image and replace the link with your own. It requires one more user click, but it's probably the best you can do. Caja locks down everything output by the HTML Service pretty tight, so things like window.location.replace("http://www.example.com"); or window.location.href = "http://www.example.com"; are a no go.

function redirectTest(){
  var htmlOutput = HtmlService
    .createHtmlOutput('<a href="http://www.example.com">Click Me!</a>')
    .setWidth(100)
    .setHeight(100);
 SpreadsheetApp.getUi().showModelessDialog(htmlOutput, " ");
}

(2) According to this source and this source, the following formula should work:

=HYPERLINK("http://www.example.com", IMAGE("https://www.google.com/images/srpr/logo11w.png"))

I couldn't get it to work in my tests, but the sources aren't that old.

这篇关于在Google电子表格中使图片可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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