Скрипт:
function sendlink() { SpreadsheetApp.getActiveSpreadsheet().getSheetByName(“Ответы на форму (1)”).activate(); var list = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var kolstr = list.getLastRow(); var shablon = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(“templ”).getRange(1, 1).getValue(); var abon_email = list.getRange(kolstr,3).getValue(); var abon_name = list.getRange(kolstr,2).getValue(); var abon_link = list.getRange(kolstr,4).getValue(); var send_link = “Ошибка! Свяжитесь с менеджером +799999999999”; if (abon_link == “Каталог 1”) { send_link = “https://drive.google.com/file/d/1rMZbfMbtlkUhp6P_Ejl58evvwRS8LBXZ/view?usp=sharing”; } if (abon_link == “Каталог 2”) { send_link = “https://drive.google.com/file/d/1dnw3oe5UZpYr5aBsZ-q8w17WCmthsiwQ/view?usp=sharing”; } if (abon_link == “Каталог 3”) { send_link = “https://drive.google.com/file/d/18TuTAsj2dzXFZwboW9OHpkPgi9htWBT4/view?usp=sharing”; } var message_text = shablon.replace(“{name}”,abon_name); var message_text = message_text.replace(“{link}”,send_link); Logger.log(message_text); MailApp.sendEmail(abon_email, “Ссылка для скачивания от ООО РОМАШКА”,message_text); }