Translate JP to EN by using GAS

I am making automation which automatically translate Japanese to English through call script , GAS.

I want to make system that when puting some Japsense words in one column, English is returned to another column,

So, could you tell me GAS code in this case?

0 3 136
3 REPLIES 3

Aurelien
Google Developer Expert
Google Developer Expert

Hi @T-Shigenori 

Maybe this ?

Class LanguageApp  |  Apps Script  |  Google Developers

Note this is a Google Apps Script question, not AppSheet ๐Ÿ™‚

// The code below will write "Esta es una prueba" to the log.
var spanish = LanguageApp.translate('This is a test', 'en', 'es');
Logger.log(spanish); 

the above link , how should I pass arguments from appsheet to GAS code function?

the above example, 'This is a test' is fixed word, how should I revise code for passing arguments from Appsheet?

On the other hand,  another web site shows some example,

function translateJPtoEN() {
//็ฐกๅ˜ใชๆ—ฅๆœฌ่ชžใฎๆ–‡็ซ ใ‚’็ฟป่จณใ™ใ‚‹
let text = "ใƒˆใƒณใƒใƒซใ‚’ๆŠœใ‘ใ‚‹ใจใ€ใใ“ใฏ้›ชๅ›ฝใ ใฃใŸใ€‚";
//translate้–ขๆ•ฐใงๆ—ฅๆœฌ่ชžโ†’่‹ฑ่ชžใซ่‹ฑ่จณ
let transText = LanguageApp.translate(text,'','en');
//็ฟป่จณใ—ใŸ่‹ฑๆ–‡ใ‚’ใƒญใ‚ฐ่กจ็คบใ™ใ‚‹
console.log(transText);
}

the above case, is it possible to revise it to pass the arguments from appsheet to code?

OK.

You may want to consider using the "Call a script" and "return value".

Here is the documentation:

Call Apps Script from an automation - AppSheet Help

The section "Add and configure the "Call a script" task in a bot" indicates how to pass parameter to your function translateJPtoEN.

Then, you can use this if you need it:

Use return values from Apps Script tasks - AppSheet Help

 

Top Labels in this Space