Convert Number to Text Format

Cools Thanks @LeventK

Genius!
Teşekkürler elinize sağlık

1 Like

I try using this but give wrong text if number below 100

@Jkr_Ckmnt
Thanks bringing it to my attention. The glitch is now fixed.

1 Like

:+1::+1::+1:

Thank you very much Mr. LeventK.

I tried and tried to make it in Million (not only thousands), however always fail. Can you help me please?

@Bpinontoan
I have updated the app to textify numbers up to 999,999,999. Provided you have copied my app, please delete that app and copy the new one to see and adopt the changes.

3 Likes

TRANSLATION FEATURE ADDED


Also added the translation feature via Google Translate API in compliance with ISO-639-1 Code which supports 109 languages via NMT/PBMT model.

5 Likes

Whoa! Nice!

1 Like

STANDALONE WEBHOOK


A couple of members had texted me that, they have copied the app but translation feature is not working :smiley: That’s so normal, because the app is using a standalone webhook workflow. To make it working for you; there are a couple of steps that you shall follow:

1. You need to subscribe to Google Cloud
2. You need to activate Google Translate API and generate an API Key (check it here)
3. Create a Google Apps Script (you can copy the code below), make necessary changes as per your requirements and deploy the script as a WebApp. When deploying, you shall ensure that the webapp is deployed for use of Anyone, even anonymous. Take a note of the generated webapp URL, as you will need it for your AppSheet Webhook Workflow


THE CODE


var SHEETID = "Your Sheet ID here";
var SHEETNAME = "Your Sheet Name here where you want the translation to be recorded";
var TR_COL_INDEX = 7; // The column index (A=1) in your sheet for the translation record
var API_KEY = "Your API Key here";
Logger = BetterLog.useSpreadsheet(SHEETID);

function doPost(e) {
  Logger.log("Number2Text Webhook triggered...");
  var payload = JSON.parse(e.postData.contents);
  var string = payload.InWords;
  var target = payload.TargetL;
  var rowNr = parseInt(payload.RowNr);
  try {
    var baseURL = "https://translation.googleapis.com/language/translate/v2?key=API_KEY";
  
    var payload = {
      "q" : string,
      "source" : "en",
      "target" : target,
      "format" : "text"
    }
    
    var headers = {
      'content-type': 'application/json'
    }
    
    var options = {
      "method" : "post",
      "payload" : JSON.stringify(payload),
      "headers" : headers
    };
    
    var response = JSON.parse(UrlFetchApp.fetch(baseURL, options));
    var trText = response.data.translations[0].translatedText;
    SpreadsheetApp.openById(SHEETID).getSheetByName(SHEETNAME).getRange(rowNr, TR_COL_INDEX).setValue(trText);
    
    Logger.log("Source Language: en"+"\nTarger Language: "+target+"\nString: "+string+"\nTranslation: "+trText);
    
    return ContentService    // return json success results
    .createTextOutput(
      JSON.stringify({"result":"success",
                      "data": JSON.stringify(payload) }))
    .setMimeType(ContentService.MimeType.JSON);
  } catch (e) {
    MailApp.sendEmail("youremail@domain.com", "Webhook Error Occured!", 
                      "\r\nMessage: " + e.message
                      + "\r\nFile: " + e.fileName
                      + "\r\nLine: " + e.lineNumber);
    e = (typeof e === 'string') ? new Error(e) : e;
    Logger.severe('%s: %s (line %s, file "%s"). Stack: "%s" . While processing %s.',e.name||'', 
                  e.message||'', e.lineNumber||'', e.fileName||'', e.stack||'', processingMessage||'');
    throw e;
  }
}

APPSHEET WEBHOOK WORKFLOW


4 Likes

Hi mr. LeventK … awesome your helps.
I am still waiting How to convert number to Text format in million (not just thousands).

From your apps… i tried and tried to modify but always fail…
Could you help me?

Thank you and very appreciate,

Have you copied the latest app build? As I have updated the app to cover the number range up-to 999,999,999

Wow…
Where and how can i get Or copy of the apps?

Thank you very much

I am sorry… Copy from Where?

Finally… i got already.

Thank you and thank you very much Mr. LeventK.

Awesome!

1 Like

@Bpinontoan
You’re very welcome, my pleasure. Glad to hear that you figured it out.

1 Like

I created a number-to-letter table list and used the lookup for reference. This method has many limitations but I am using it very simply and effectively for newbies.

Tiền Đọc số
1000 Một nghìn đồng
2000 Hai nghìn đồng
3000 Ba nghìn đồng
4000 Bốn nghìn đồng
5000 Năm nghìn đồng
6000 Sáu nghìn đồng
7000 Bảy nghìn đồng
8000 Tám nghìn đồng
9000 Chín nghìn đồng
10000 Mười nghìn đồng
11000 Mười một nghìn đồng
12000 Mười hai nghìn đồng
13000 Mười ba nghìn đồng
14000 Mười bốn nghìn đồng
15000 Mười năm nghìn đồng
16000 Mười sáu nghìn đồng
17000 Mười bảy nghìn đồng
18000 Mười tám nghìn đồng
19000 Mười chín nghìn đồng
20000 Hai mươi nghìn đồng

1 Like

@LeventK, t is a work of genius! Thank you

1 Like

Thnx @Guy_Merlin_Dyangnou, my pleasure.

@LeventK

this is Greate solution, sir,

I am trying to do some change to the Indian amount methods

where
one hundred thousand = 1 lakhs
millions become 10 lakhs
10 million become 1 crore.
100 million = 10 crore

working on it if possible then please provide some hints because expressions are very impressiove and longs. and i want to stop this ate 10 crores.