Last active
November 30, 2022 16:30
-
-
Save bpwebs/4c963a28c783e69e9f1ef0ae3cdafab8 to your computer and use it in GitHub Desktop.
Email Google Sheets table to inbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Email Google Sheets table to inbox.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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