google apps script - simple macro at spreadsheet not running native function -


in script.google.com/macros/d/1rrm3wod.... page have

function wd_hyperlink(x) {   return hyperlink("https://www.wikidata.org/wiki/"+x,x) } 

so, when use in originator (a https://docs.google.com/spreadsheets/d/1hwih... spreadsheet page), calling =wd_hyperlink('q131303') in cell, runs not recognize native function hyperlink().

line 2, hyperlink not defined.

hyperlink formula. can't use did. have set formula cell.

var myfunction = '=hyperlink("https://www.wikidata.org/wiki/&'+x+'", '+x+')'; spreadsheetapp.getactivespreadsheet()    .getsheetbyname("sheetname")    .getrange("a1")//cell    .setformula(myfunction); 

but from documentation : custom functions (wd_hyperlink(x)) return values, cannot set values outside cells in.

it doesn't work this..

function wd_hyperlink(x)  {   var myfunction= '=hyperlink("https://www.wikidata.org/wiki/&'+x+'", '+x+')';   var cell = spreadsheetapp.getactivespreadsheet().getactivesheet().getactivecell();      cell.setformula(myfunction); } 

in case can use (it display full link though),

 function wd_hyperlink(x)   {     return  "https://www.wikidata.org/wiki/&"+x;  } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -