Z
Z
zekin3752020-05-31 21:57:09
Google Sheets
zekin375, 2020-05-31 21:57:09

How to send emails from google sheets?

There is a Google table with the following values

​​Column 1: Product name 1
Column 2: 5 pcs
Column 3: [email protected]

And such different for example 50 lines, an email address can be written in a chaotic manner, email can be repeated several times in different lines.

The next task is how to make it so that when a button is pressed, a letter is generated to the desired email with a list of goods where the specified email is located.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2020-06-01
@ProgrammerForever

1) Get data from desired range

var inData = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Лист1").getRange("A1:C").getValues();

2) Filter by the desired email (for reliability, I would still bring everything to lower case)
inData = inData.filter(row=>row[2]==="[email protected]");

3) Collect a letter from the rest of the array and send it using MailApp. sendEmail (recipient, subject, body)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question