0
votes

I have a google Form, and the responses populate a response google Sheet, which has a google Script function to generate a google Document using a template.

I am trying to get the address entered in the Form (stored in the response Sheet) to become a hyperlink in the generated Doc. I have been using the body.replaceText() to replace all the fields I need in the Doc:

    body.replaceText("{{Date}}", date);

and its working well, but the address field I would like to become a hyperlink.

I have been trying to do it this way:

    body.replaceText("{{Location}}", =HYPERLINK("http://www.google.com/maps/place/'+location+'"));

But that does not become a usable hyperlink, resulting with this in the Doc (please note while it becomes a hyperlink on this page it does not become a hyperlink in Docs):

=HYPERLINK("http://www.google.com/maps/place/myplacenotyours")

I have also tried:

   body.replaceText("{{Location}}", location = HYPERLINK("http://www.google.com/maps/place/"+location+));

But this throws up syntax errors.

I have this var:

     var location = e.values[2];

So perhaps it better to use that to create another var as a hypertext? I am now trying:

     var loclink = 'Hyperlink("http://www.google.com/maps/place/'+location+'","'+location+'")'; 

but that doesnt do it either...

Sorry for the noob question, but I can't figure this out. Can you help me find a solution and put a var into a hypertext Doc link?! Cheers.

I don't really know about google docs stuff, but i did some research and there is a method called setLinkUrlPyxlDavon
I am now trying to set a new variable into a hyperlink, that references the variable pulled from the sheet...sandysound