function sendEmail(){
var ss=SpreadsheetApp.getActive();
var sh=ss.getActiveSheet();
var list=sh.getRange(2,1,sh.getLastRow()-1,sh.getLastColumn()).getValues();
var recipient="emaild@gmail.com";
var subject="Multiples prices have changed";
var html='<style>td{border:px solid black;}#td1{font-size:22;color:black;font-weight:bold;}#td2{font-size:16;color:red;}{</style><table>';
for(var i=0; i<list.length;i++){
html+=Utilities.formatString('<tr><td id="td1">%s</td></tr><tr><td id="td2">%s</td></tr>',list[i][0],`${list[i][1]} ${list[i][2]}.`);
}
GmailApp.sendEmail(recipient, subject,'',{htmlBody: html});
//var ui=HtmlService.createHtmlOutput(html);
//SpreadsheetApp.getUi().showModelessDialog(ui, 'Price Changes')
}
Вот как выглядит моя таблица:
А вот CSV моих данных:
Product,Direction,Amount
Product1,price has increased ,10
Product2,price has increased ,20
Product3,price has increased ,30
Product4,price has increased ,40
Product5,price has increased ,50
Product6,price has increased ,60