google apps script - Format Table in Email GAS -


The following code sends an email, along with the selected row data, I need help formatting the output table.

  function sendemail () {var ss = SpreadsheetApp.getActiveSpreadsheet (); Var Letter = ss.getSheetByName ("Visitor Log"); Var user = session .getActiveUser (); Var activecell = sheet.getActiveCell (). GetRow (); Var startdate = Utilities formatted ((Sheet.Tetase (ActiveCell, 2) .getValue ()), 'IST', 'DD / MMM / Yay'); Var Endadet = Utilities Formated ((Sheet.GetRenz (ActiveCell, 3) .getValue ()), 'IST', 'DD / MMM / YYA'); Var Visitors name = sheet.getRange (active cell, 4) .getValue (); Var designation = sheet.getRange (active cell, 5) .getValue (); Var body = "body" + = "<< tr> tr style = 'padding: 5px' & gt;" + Start + "& lt; / tr & gt; & lt; tr style = 'padding: 5px' & gt;" + Ended + "& lt; / tr & gt; & lt; tr style = 'padding: 5px' & gt;" + Visitor's name + " & lt; tr style = 'padding: 5px' & gt;" + Designation MailApp.sendEmail (user, "visitor details", body, {html body: body, cc: 'xxx@gmail.com'}); }   

Email received

  February 17/2014 23 / February / 2014 Wasim Manager   

Email required

  Start date 17 / February / 2014 expiration date 23 / Feb / 2014 Visitor name Wasim Designation Manager   

Hard-code headers will be great and yes if I Some colorful backgrounds may also be found (as I have some other variables defined, the loop does not have a sheet)

Your code here with some code: Send function () {var ss = SpreadsheetApp.getActiveSheet (); // var ss = SpreadsheetApp.getActiveSpreadsheet (); // var letter = ss.getSheetByName ("Visitor log"); Var user = session .getActiveUser (); Var line = ss.getActiveCell (). GetRow (); // var activecel = sheet.getActiveCell (). GetRow (); Var vals = ss.getRange (line, 2, 1, 4) .getValues ​​(); Var startdate = utilities.formatadet (new date (wal [0] [0]), 'ist', 'dd / mmm / yay'); Var Endadet = Utilities Format date (new date (wal [0] [1]), 'IST', 'DD / MMM / yay'); Var Visitors name = vals [0] [2]; Var designation = wal [0] [3]; Var body = "" var thistle = "padding: 5px;"; Var tdStyle = "font-style: oblique; background-color: #BDBDBD"; Var table style = "border: 1px" body + = "& gt; table style = '" + table style + "' gt; Start date & lt; / th style = '' + Thistle +" and "+" & lt; Td style = '"+ tdStyle +"'> gt; + Startdate + "& lt; / td> & lt; / tr & gt;" + "& lt; tr & gt; '& gt; Expiry date & lt; / th & gt;" + "& lt; Td style = '"+ tdStyle +"'> & gt; + Enddate + "& lt; / td> & lt; / tr & gt; + "& Lt; tr & gt; & lt; st style = '" + thStyle + "'>" + "& lt; tr & gt; & lt; th style = 'Visitor's name & lt; / th & Lt; td style = '"+ tdStyle +"'> "+ Visitors name +"

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -