Last active
July 8, 2022 07:28
-
-
Save seoutopico/ecffdec37ccc92133588f1760ef517d1 to your computer and use it in GitHub Desktop.
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 sendEmail() { | |
let fechahoy = new Date().toLocaleDateString() | |
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("comparativa"); | |
var data = ss.getRange ("A1:D5").getValues(); | |
var message = getTable(data); | |
var mensaje = { | |
to: "destino", | |
subject : "Estas SEO" + fechahoy, | |
htmlBody: message, | |
name: "Aina-Lluna Taylor Barceló - SEO" | |
} | |
MailApp.sendEmail(mensaje); | |
} | |
function getTable(data) { | |
var result = ["<table'>"]; | |
var ll = data[0].length; | |
var row = 0; | |
for(var i = 0, l = data.length; i < l; i++) { | |
row = data[i]; | |
result.push("<tr>"); | |
for(var ii = 0; ii < ll; ii++){ | |
result.push('<td>' + row[ii] + '</td>'); | |
} | |
result.push("</tr>"); | |
} | |
result.push("</table>"); | |
return( result.join('\n')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Script que te permite enviar mails desde un rango de datos en una tabla de html