Skip to content

Instantly share code, notes, and snippets.

@bpwebs
Last active November 30, 2022 16:30
Show Gist options
  • Save bpwebs/4c963a28c783e69e9f1ef0ae3cdafab8 to your computer and use it in GitHub Desktop.
Save bpwebs/4c963a28c783e69e9f1ef0ae3cdafab8 to your computer and use it in GitHub Desktop.
Email Google Sheets table to inbox
#Email Google Sheets table to inbox.txt
function emailCryptoNews() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const todayNewsSheet = ss.getSheetByName("Today's News"); //CHANGE: Namme of the sheet
const todayNewsRange = todayNewsSheet.getDataRange();
const todayNews = todayNewsRange.getValues();
let table = "<html><body><table border=1>"
for(let i=0; i<todayNews.length; i++){
let cells = todayNews[i];
table = table + "<tr>";
for(let u=0;u<cells.length;u++){
table = table + '<td>'+cells[u]+'</td>'
}
table = table+"</tr>"
}
table = table+"</table>"
MailApp.sendEmail({
to:"contact@bpwebs.com", //CHANGE: Email address of the recipient
subject:"Crypto News Today", //CHANGE: Subject of the email
htmlBody: table
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment