Convert Number to Text Format

@tsg_despatch
Something like this?
You’re free to take a copy of this app from my portfolio:
Portfolio URL: https://www.appsheet.com/portfolio/245151
App Name: Number2Text

7 Likes

Neat!!!

1 Like

Thanks @Steve, appreciated.

Wow! Really very creative implementation @LeventK !

1 Like

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.

4 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