0

I'm using a gs function to append the address value to navigator API:-

function myhome(){
var sheet=SpreadsheetApp.openById('THIS_SHEET_ID').getSheetByName("addresses");

var address='Kuala Lumpur International Airport';
var locationwaze=wazelink(address); //calling waze API that returns URL to navigate via waze
var locationgmap=gmaplink(address); //calling googlemaps API that returns URL to navigate via googlemaps

var myhome=HtmlService.createTemplateFromFile("mymap");
  myhome.address=address;
  myhome.locationwaze=locationwaze;
  myhome.locationgmap=locationgmap;
var htmlemail = myhome.evaluate().getContent();

 MailApp.sendEmail("justuser@gmail.com","My Home","",{htmlBody:htmlemail});
}

My html code <a href="<?=locationwaze?>"><?=address?></a> to allow when recipient clicks on the address, it will auto-redirect to the waze navigator.

I'm trying to achieve 2 objectives below:-

  1. When user open the email from smartphone, upon clicking the address will redirect them to waze app by default but to googlemaps app when waze app is not installed/unavailable.
  2. When both navigator apps are not available or user clicks while opening the email in PC, the user will only see text with no hyperlink.

Currently, my code only sets to use waze app only. I don't know if this can be done in GAS or JS in the html body or a simple html code will do.

Rubén
  • 24,097
  • 9
  • 55
  • 116
dell
  • 167
  • 11

0 Answers0