table="<table border=0><tr><th>URL</th><th>Campaign Name</th></tr>";
table=table+"<tr><td>www.example.com</td><td>Display Campaign</td></tr>";
table=table+"</table>";
sendEmail("ma...@example.com", table);
function sendEmail(email, data) {
var formattedDate = Utilities.formatDate(new Date(), "GMT+03:00", "dd-MM-yyyy 'at' hh:mm 'GMT+3'");
var subject = "Subject - " + formattedDate;
Logger.log("Sending email, subject: " + subject);
var body = "\n " + data;
MailApp.sendEmail(email, '',subject, body);
}
<table border=0><tr><th>URL</th><th>Campaign Name</th></tr><tr><td>www.example.com</td><td>Display Campaign</td></tr></table>
MailApp.sendEmail(email, '', subject, {htmlBody: body.join('\n')});TypeError: Cannot find function join in objectHow do i put in a variable instead of the url
Hi Isiah,
Could you confirm if what you want is to change the fixed URL on the line of code below and replace it with a variable?
table=table+"<tr><td>www.example.com</td><td>Display Campaign</td></tr>";
If yes, then you may use the modified line of codes below.
var url = 'INSERT_URL_HERE';
table="<html><body><br><table border=0><tr><th>URL</th><th>Campaign Name</th></tr>";
table=table+"<tr><td> "+ url +" </td><td>Display Campaign</td></tr>";
table=table+"</table></body></html>
Let me know if you have further questions.
Regards,
Ejay
Google Ads Scripts Team