将超链接和链接合并到Google电子表格的脚本中 [英] Incorporate hyperlink and link in script for Google spreadsheet

查看:84
本文介绍了将超链接和链接合并到Google电子表格的脚本中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在拼命尝试在脚本中包含超链接,在执行脚本之后,应将此处的超链接放置在单元格C16中. C17-C19和G19同样如此.

I am currently trying desperately to include a hyperlink in my script that, after executing the script, the hyperlink as it is here should be placed in cell C16. The same would be for C17-C19 and in G19 again.

function AlteFahrerdatenLeeren(){ 
  var sheet=SpreadsheetApp.getActiveSheet(); 
  var destination="C7:C15"; 
  sheet.getRange(destination).setValue(""); 
  var sheet1=SpreadsheetApp.getActiveSheet(); 
  var destination="C20"; 
  sheet1.getRange(destination).setValue(""); 
  var sheet2=SpreadsheetApp.getActiveSheet(); 
  var destination="G6:G7"; 
  sheet2.getRange(destination).setValue(""); 
  var sheet3=SpreadsheetApp.getActiveSheet(); 
  var destination="G9"; 
  sheet3.getRange(destination).setValue(""); 
  var sheet4=SpreadsheetApp.getActiveSheet(); 
  var destination="G11:G17"; 
  sheet4.getRange(destination).setValue(""); 
  var sheet5=SpreadsheetApp.getActiveSheet(); 
  var destination="G20"; 
  sheet5.getRange(destination).setValue(""); 
  var sheet5=SpreadsheetApp.getActiveSheet(); 
  var destination="N16:N17"; 
  sheet5.getRange(destination).setValue(""); 
  var sheet6=SpreadsheetApp.getActiveSheet(); 
  var destination="Q10:R10"; 
  sheet6.getRange(destination).setValue(""); 
  var sheet7=SpreadsheetApp.getActiveSheet(); 
  var destination="S6"; 
  sheet7.getRange(destination).setValue(""); 
  var sheet8=SpreadsheetApp.getActiveSheet(); 
  var destination="O22:S32"; 
  sheet8.getRange(destination).setValue(""); 
  var sheet9=SpreadsheetApp.getActiveSheet(); 
  var destination="G35:S50"; 
  sheet9.getRange(destination).setValue(""); 
  var sheet10=SpreadsheetApp.getActiveSheet(); 
  var destination="B53:S91"; 
  sheet10.getRange(destination).setValue(""); 
  **var SS=SpreadsheetApp.getActiveSheet(); 
  var sheet=ss.getRange(C16).setValue(HYPERLINK("https://erfurter-fernverkehrs-logistic.de/";"Neu"));** 
}

此外,我问自己.有没有一种方法可以测试脚本中的链接,以便他可以通过按钮从C20获取最后丢失的数据,然后链接到网站?

Furthermore what I ask myself. Is there a way to test a link in a script that he can get the last missing data from C20 via a button and then link to the website?

非常感谢您的帮助.我是该地区的新手.

Help is very much appreciated. I'm completely new to the area.

在此处输入图片描述如在图片中的方框中所示在里面.但是用我的脚本,我想删除刻度线,以便只有空框.范围是:K22:L32.

enter image description here As here in the pictures, the ticks in the boxes are inside. But with my script I want to remove the tick so that there are only the empty boxes. And the range would be: K22: L32.

对不起,翻译不正确.由于我自己不会说英语,因此必须通过Google翻译来完成.

Sorry for the bad translation. Since I can't speak English myself, I had to do it via Google Translate.

推荐答案

您必须使用setFormula而不是setValue:

sheet.getRange('C16').setFormula('=HYPERLINK("https://erfurter-fernverkehrs-logistic.de/";"Neu")');

此外,您无需每次都重复此操作.您只需要执行一次:

Also, you don't need to repeat this every time. You only have to do it once:

var sheet=SpreadsheetApp.getActiveSheet();

参考:

  • Range.setFormula(formula)
  • Reference:

    • Range.setFormula(formula)
    • 这篇关于将超链接和链接合并到Google电子表格的脚本中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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