T
T
thepetyan2021-04-08 20:34:12
Google Apps Script
thepetyan, 2021-04-08 20:34:12

How to set up automatic distribution of a book in Google Docs?

Hello. The problem is this: there is a Google spreadsheet. This table is edited 24/7. And at the end of the month, you need to isolate each day and analyze it. If on some day you forget / get sick / do not have time to download the book, then at the end of the month this day will not be enough and the report will not be complete. Can I set it up so that the book is automatically sent, ideally, in telegrams, or by mail? Those. unmodified cells were sent, not selected cells (a lot of data can be added per day, or maybe not enough, the exact size of the table is not known), not separate sheets, not sending to several recipients with one button, but just every day at 20:00 the book was sent to me by mail? I heard it can be done, but I can't google it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2021-04-09
@thepetyan

Here is the code, set the daily trigger to the right time. And enter your email d targetEmail

const targetEmail = ``; // email для отправки

function f(){
  let ss = SpreadsheetApp.getActiveSpreadsheet();
  let blob = ss.getAs(`application/pdf`);

  try{
    GmailApp.sendEmail(targetEmail, 'backup', 'pdf файл во вложении', {     
          attachments: [blob],
    });
    Logger.log(`Письмо отправлено`);
  }catch(e){
    Logger.log(e);
  }  
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question