1

This question is related to my previous post.

I'm trying to "build" a link to a specific range inside a Sheet. So, I'm building something like this https://docs.google.com/spreadsheets/d/1XXXXXX/edit#gid=99999999&range=A2:D2 The build is working fine but when it runs through the template and evaluate process something is lost and the "&" turns into "%E2%A6%A5". Any thoughts?


Edit1: Here's a minimal script snippet

var link = 'https://docs.google.com/spreadsheets/d/XXXXXX#gid=999999' + "&" + "&range=A" + (i + 2) + ":D" + (i + 2);

var emailtemplate = HtmlService.createTemplateFromFile('Monthly pulse check');
  emailtemplate.OOOPULSE = link;

  var emailbody = emailtemplate.evaluate();
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <?!=OOOPULSE?>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
  </body>
</html>
user13708028
  • 315
  • 3
  • 13
  • 1
    Questions should stand on their own; I shouldn't need to open your other question to understand what's going on. Please provide a [mre] in *this* question as well. – Heretic Monkey Dec 15 '20 at 18:31
  • Rendering the text directly in the body doesn't render it as a clickable link in the first place – TheMaster Dec 15 '20 at 19:16
  • The link is still clickable and it even still leads to the correct Sheet. However, it doesn't lead to the correct range because the "&" is missing from the output. Here's the output https://docs.google.com/spreadsheets/d/XXXXXX/edit#gid=999999%E2%A6%A5=A7:D7 – user13708028 Dec 15 '20 at 19:19
  • 3
    I can't explain why I'd try this but try this: `var link = 'https://docs.google.com/spreadsheets/d/XXXXXX#gid=999999' + "&" + "&range=A" + (i + 2) + ":D" + (i + 2);` This question might provide more information if you wish: https://stackoverflow.com/questions/3493405/do-i-really-need-to-encode-as-amp – Cooper Dec 15 '20 at 19:55
  • 1
    That did it! Thanks – user13708028 Dec 15 '20 at 21:00

0 Answers0