- Translation into a several languages simultaneously
1.1 Firstly make menu to run your scripts
function onOpen(){
//in the table is being added a new menu
var spreadsheet= SpreadsheetApp.getActive();
var menuItems=[
{name: 'market_place', functionName: 'market_place'},
];
spreadsheet.addMenu('Myoption', menuItems);
}
2. Next consider the possibility of translating text into several languages at the same time thanks to a script onEdit.
We use scripts from the website: www.codd-wd.ru I am not going to paste out here all script, provided you wish you can watch the video. Out there it more precisely has been explained.
2.1 find language App
2.2 Copy the script and go to extensions/Apps script
3. Line 40:41 responsible for the translation of a language. There you can input any language
3.1 After you had pasted the code and save it, it will be translated automatically in English you input a phrase in Russian in cell A1
4. How to translate into a sever languages simultaneously ?
4.1 Copy range of lines between 38:48
// Переводим текст на английский
// https://developers.google.com/apps-script/reference/language/language-app
var translatedText = LanguageApp.translate(
russianText, // текст
'ru', // с какого языка переводим
'en' // на какой язык переводим
);
// Вставляем переведённый текст во вторую колонку
sheet.getRange(
cell.getRowIndex(), // номер строки
2 // номер столбца
).setValue(translatedText);
4.2 paste it under line 48
// Переводим текст на английский
// https://developers.google.com/apps-script/reference/language/language-app
var translatedText = LanguageApp.translate(
russianText, // текст
'ru', // с какого языка переводим
'en' // на какой язык переводим
);
// Вставляем переведённый текст во вторую колонку
sheet.getRange(
cell.getRowIndex(), // номер строки
2 // номер столбца
).setValue(translatedText);
var translatedText = LanguageApp.translate(
russianText, // текст
'ru', // с какого языка переводим
'it' // на какой язык переводим <---
);
// Вставляем переведённый текст во вторую колонку
sheet.getRange(
cell.getRowIndex(), // номер строки
3 // номер столбца <---
).setValue(translatedText);
}
}
5. Result
2. Sending email using the MailApp library
2.1 part of code to send one message
function myFunction10() {
MailApp.sendEmail({
to:"email",
subject:"check it out",
body:"I've discovered google script it so cool!",
})
}
3. Code to send message with pdf file
function myFunction10() {
var pdfFileBlob=DriveApp.getFileById("...id...").getBlob();
MailApp.sendEmail({
to:"email...",
subject:"check it out",
body:"I've discovered google script it so cool!",
attachments:[pdfFileBlob]
})
}
4. Part of code send to many
function myFunction10() {
var message={
to:"email...",
subject:"check it out",
body:"I've discovered google script it so cool!",
cc:"email...",
ccc:"...",
ccccc:"...",
}
MailApp.sendEmail(message)
}
3.Sidebar
No responses yet