N
N
Nik322020-02-26 23:08:03
PHP
Nik32, 2020-02-26 23:08:03

How to send an email by cell condition from a specific column?

Hello, tell me, is it really possible to do the current? There is a column "M:M", in it, in each cell, the formula is used to calculate, and when any cell is equal to "Sending", then you need to copy the cell "S" and send it to the same mail with the subject "for an employee". For example, in cells "M1201", the formula calculated "Sending", then it should copy the cell "S1201" and send it to the mail with the subject "for employee". I found this script, help me apply it to me.

VAR ID =""; //speadsheet id
var EMAIL = " Вадим@Шема.команда"; / / электронная почта 
VAR RANGE =""; //диапазон данных для отправки
проверка var= ""; / / параметры
var text = ""; / / subject

функция sendData() {
 var электронная таблица = SpreadsheetApp.openById(ID);
 var data = электронная таблица.getRangeByName (диапазон).getValues();
 var message = {};
 if (SpreadsheetApp.openById (ID).getRangeByName (проверка).getValues()
 Сообщение.тема = "[Шема] " + текст;
 message.to = электронная почта;
 Сообщение.htmlBody = dataToHtmlTable_ (данные) +
 "<br><br><br>[SHEMA]";
 MailApp.sendEmail(сообщение);
  }
}

Массив.прототип.datesToString = функция(){
 верните это.карта (функция (строка){
 верните строку.карта (функция (ячейка){
 возврат ячейки & & cell.- есть время ? Служебные программы.formatDate(ячейка, сессия.getScriptTimeZone (), "гггг-ММ-ДД"): ячейка;
    });
  });
}


функция dataToHtmlTable_(данные){
 возвращение JSON.stringify(данные, null, " ")
 .заменить (/^\[/g, " <таблица>")
 .заменить (/\]$ / g, " < / table>")
 .заменить(/^\s\s\[$/mg, " <tr>")
 .заменить(/^\s\s\], {0,1}$ / mg, " < / tr>")
 .заменить(/^\s{4} " {0,1}(.*?)"{0,1},{0,1}$/mg, " <td > $1<td > < / td>");
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kafkiansky, 2019-07-07
@IwanQ

Do pagination. To do this, you need to get the number of all movies, divide it by the number of movies on one page (let's say 20) and round the result up using ceil. Then display the number of pages through the loop and make links like ?page=$i. Now, with each request for the next page, you make a request to the database using LIMIT, where you first specify the number of films per page (20), and then the offset from which to take films (page number * number of films).

A
Aleksandr, 2020-04-30
@iSeb

var email = sheetInfo.getRange('B4').getValue(); // assign mail address from cells B4 eg
var subject = sheetInfo.getRange('B5').getValue(); // assign subject to email subject
var txt = sheetInfo.getRange('B6').getValue(); // here we set the text of the letter
if (sheet.getRange('C3').getValue() = 'Send') {
MailApp.sendEmail(email, subject, txt); // mail is sent
}
maybe this ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question