Google-sheets – Save daily to the Gmail in Google Sheets

gmailgoogle sheetsgoogle-apps-script

Right now what I have is this in a Google sheet for my company daily lunch program:

function sendLunchPerkSummery() {
  var d = Date();
  var file = DriveApp.getFileById('1oOXv1PF9mL0pAUa_jWyac7lsLdWOAIVRpq49Hl1ioH4');  
  MailApp.sendEmail('xzy@gmail.com', 'LunchPerkRecord PDF', d, {
     name: 'Lunch Perk Emailer',
     attachments: [file.getAs(MimeType.PDF)]//, blob]

  });
}

This sends me a (daily) email making the sheet into a PDF and I have a record of it.

One problem: The formatting is HORRIBLE. It doesn’t look at all like my clean sheet. Rows are cut off and put on page 2-6 or the PDF. Is there a way I can get the formatting to look more like what I see in the sheet? WYSIWYG?

Best Answer

Rather than a "Mail Merge" solution (one document for each record in a list), one alternative that could work for you use is something like UltraDox that include a feature to insert a spreadsheet into a Google document.

I didn't tried it yet.