0

I am currently trying to export data from the spreadsheet to JPEG/PNG format and use it the email body as an Inline image rather than an attachment. previously, I used to export the data to PDF and send as an attachment using the below code:

function sendReport() {  

    var message = {
        to: "trial@gmail.com",
        subject: "Random Subject Line",
        body: "This is just a trial. Ignore.",
        name: "Name",
        attachments: [SpreadsheetApp.getActiveSpreadsheet().getAs(MimeType.PDF).setName("SampleOutput")]
      }
      MailApp.sendEmail(message);
    }

I tried changing the MimeType to PNG, but it returned an error. Is there any way to do this? I couldn't find any existing solution to this issue. PS: I need data to be captured for the first 10 rows only OR till the row where data ends.

Rubén
  • 34,714
  • 9
  • 70
  • 166
Gitz
  • 63
  • 5
  • In your situation, is this thread useful? https://stackoverflow.com/q/73204237 – Tanaike Dec 20 '22 at 01:22
  • Not really. This requires the user to go in, manually select the range that needs to be printed and then run the code every time. Does not give any automation advantage here. – Gitz Dec 20 '22 at 09:15
  • Thank you for replying. About `Not really. This requires the user to go in, manually select the range that needs to be printed and then run the code every time. Does not give any automation advantage here.`, I deeply apologize that my comment was not useful for your situation. I think that this is due to my poor English skill. I deeply apologize for my poor English skill. I think that I have to study English more. – Tanaike Dec 20 '22 at 11:15

0 Answers0