Assuming that your formula is
=CHOOSE(LEFT(TEXT(B3,"000000000.00"))+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine")
&IF(--LEFT(TEXT(B3,"000000000.00"))=0,,IF(AND(--MID(TEXT(B3,"000000000.00"),2,1)=0,--MID(TEXT(B3,"000000000.00"),3,1)=0)," Hundred"," Hundred and "))
&CHOOSE(MID(TEXT(B3,"000000000.00"),2,1)+1,,,"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety ")
&IF(--MID(TEXT(B3,"000000000.00"),2,1)<>1,CHOOSE(MID(TEXT(B3,"000000000.00"),3,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine"),
CHOOSE(MID(TEXT(B3,"000000000.00"),3,1)+1,"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"))
&IF((--LEFT(TEXT(B3,"000000000.00"))+MID(TEXT(B3,"000000000.00"),2,1)+MID(TEXT(B3,"000000000.00"),3,1))=0,,IF(AND((--MID(TEXT(B3,"000000000.00"),4,1)+MID(TEXT(B3,"000000000.00"),5,1)+MID(TEXT(B3,"000000000.00"),6,1)+MID(TEXT(B3,"000000000.00"),7,1))=0,(--MID(TEXT(B3,"000000000.00"),8,1)+RIGHT(TEXT(B3,"000000000.00")))>0)," Million and "," Million "))
&CHOOSE(MID(TEXT(B3,"000000000.00"),4,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine")
&IF(--MID(TEXT(B3,"000000000.00"),4,1)=0,,IF(AND(--MID(TEXT(B3,"000000000.00"),5,1)=0,--MID(TEXT(B3,"000000000.00"),6,1)=0)," Hundred"," Hundred and"))
&CHOOSE(MID(TEXT(B3,"000000000.00"),5,1)+1,,," Twenty"," Thirty"," Forty"," Fifty"," Sixty"," Seventy"," Eighty"," Ninety")
&IF(--MID(TEXT(B3,"000000000.00"),5,1)<>1,CHOOSE(MID(TEXT(B3,"000000000.00"),6,1)+1,," One"," Two"," Three"," Four"," Five"," Six"," Seven"," Eight"," Nine"),CHOOSE(MID(TEXT(B3,"000000000.00"),6,1)+1," Ten"," Eleven"," Twelve"," Thirteen"," Fourteen"," Fifteen"," Sixteen"," Seventeen"," Eighteen"," Nineteen"))
&IF((--MID(TEXT(B3,"000000000.00"),4,1)+MID(TEXT(B3,"000000000.00"),5,1)+MID(TEXT(B3,"000000000.00"),6,1))=0,,IF(OR((--MID(TEXT(B3,"000000000.00"),7,1)+MID(TEXT(B3,"000000000.00"),8,1)+MID(TEXT(B3,"000000000.00"),9,1))=0,--MID(TEXT(B3,"000000000.00"),7,1)<>0)," Thousand "," Thousand and "))
&CHOOSE(MID(TEXT(B3,"000000000.00"),7,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine")
&IF(--MID(TEXT(B3,"000000000.00"),7,1)=0,,IF(AND(--MID(TEXT(B3,"000000000.00"),8,1)=0,--MID(TEXT(B3,"000000000.00"),9,1)=0)," Hundred "," Hundred and "))&
CHOOSE(MID(TEXT(B3,"000000000.00"),8,1)+1,,,"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety ")
&IF(--MID(TEXT(B3,"000000000.00"),8,1)<>1,CHOOSE(MID(TEXT(B3,"000000000.00"),9,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine"),CHOOSE(MID(TEXT(B3,"000000000.00"),9,1)+1,"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen")),
you can implement it into your existing code as following:
function autoFillGoogleDocFromForm(e) {
var timestamp = e.values[0];
var date_Dayof = e.values[1];
var month = e.values[2];
var ownername_MR_MRS_MS = e.values[" + row + "];
var RentAmount = e.values[4];
var column = 20; // column T
var row = e.range.getRow();
var sheet = e.range.getSheet();
sheet.getRange(row, column).setFormula("=CHOOSE(LEFT(TEXT(B" + row + ",\"000000000.00\"))+1,,\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\")\r\n&IF(--LEFT(TEXT(B" + row + ",\"000000000.00\"))=0,,IF(AND(--MID(TEXT(B" + row + ",\"000000000.00\"),2,1)=0,--MID(TEXT(B" + row + ",\"000000000.00\")," + row + ",1)=0),\" Hundred\",\" Hundred and \"))\r\n&CHOOSE(MID(TEXT(B" + row + ",\"000000000.00\"),2,1)+1,,,\"Twenty \",\"Thirty \",\"Forty \",\"Fifty \",\"Sixty \",\"Seventy \",\"Eighty \",\"Ninety \")\r\n&IF(--MID(TEXT(B" + row + ",\"000000000.00\"),2,1)<>1,CHOOSE(MID(TEXT(B" + row + ",\"000000000.00\")," + row + ",1)+1,,\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\"),\r\nCHOOSE(MID(TEXT(B" + row + ",\"000000000.00\")," + row + ",1)+1,\"Ten\",\"Eleven\",\"Twelve\",\"Thirteen\",\"Fourteen\",\"Fifteen\",\"Sixteen\",\"Seventeen\",\"Eighteen\",\"Nineteen\"))\r\n&IF((--LEFT(TEXT(B" + row + ",\"000000000.00\"))+MID(TEXT(B" + row + ",\"000000000.00\"),2,1)+MID(TEXT(B" + row + ",\"000000000.00\")," + row + ",1))=0,,IF(AND((--MID(TEXT(B" + row + ",\"000000000.00\"),4,1)+MID(TEXT(B" + row + ",\"000000000.00\"),5,1)+MID(TEXT(B" + row + ",\"000000000.00\"),6,1)+MID(TEXT(B" + row + ",\"000000000.00\"),7,1))=0,(--MID(TEXT(B" + row + ",\"000000000.00\"),8,1)+RIGHT(TEXT(B" + row + ",\"000000000.00\")))>0),\" Million and \",\" Million \"))\r\n&CHOOSE(MID(TEXT(B" + row + ",\"000000000.00\"),4,1)+1,,\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\")\r\n&IF(--MID(TEXT(B" + row + ",\"000000000.00\"),4,1)=0,,IF(AND(--MID(TEXT(B" + row + ",\"000000000.00\"),5,1)=0,--MID(TEXT(B" + row + ",\"000000000.00\"),6,1)=0),\" Hundred\",\" Hundred and\"))\r\n&CHOOSE(MID(TEXT(B" + row + ",\"000000000.00\"),5,1)+1,,,\" Twenty\",\" Thirty\",\" Forty\",\" Fifty\",\" Sixty\",\" Seventy\",\" Eighty\",\" Ninety\")\r\n&IF(--MID(TEXT(B" + row + ",\"000000000.00\"),5,1)<>1,CHOOSE(MID(TEXT(B" + row + ",\"000000000.00\"),6,1)+1,,\" One\",\" Two\",\" Three\",\" Four\",\" Five\",\" Six\",\" Seven\",\" Eight\",\" Nine\"),CHOOSE(MID(TEXT(B" + row + ",\"000000000.00\"),6,1)+1,\" Ten\",\" Eleven\",\" Twelve\",\" Thirteen\",\" Fourteen\",\" Fifteen\",\" Sixteen\",\" Seventeen\",\" Eighteen\",\" Nineteen\"))\r\n&IF((--MID(TEXT(B" + row + ",\"000000000.00\"),4,1)+MID(TEXT(B" + row + ",\"000000000.00\"),5,1)+MID(TEXT(B" + row + ",\"000000000.00\"),6,1))=0,,IF(OR((--MID(TEXT(B" + row + ",\"000000000.00\"),7,1)+MID(TEXT(B" + row + ",\"000000000.00\"),8,1)+MID(TEXT(B" + row + ",\"000000000.00\"),9,1))=0,--MID(TEXT(B" + row + ",\"000000000.00\"),7,1)<>0),\" Thousand \",\" Thousand and \"))\r\n&CHOOSE(MID(TEXT(B" + row + ",\"000000000.00\"),7,1)+1,,\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\")\r\n&IF(--MID(TEXT(B" + row + ",\"000000000.00\"),7,1)=0,,IF(AND(--MID(TEXT(B" + row + ",\"000000000.00\"),8,1)=0,--MID(TEXT(B" + row + ",\"000000000.00\"),9,1)=0),\" Hundred \",\" Hundred and \"))&\r\nCHOOSE(MID(TEXT(B" + row + ",\"000000000.00\"),8,1)+1,,,\"Twenty \",\"Thirty \",\"Forty \",\"Fifty \",\"Sixty \",\"Seventy \",\"Eighty \",\"Ninety \")\r\n&IF(--MID(TEXT(B" + row + ",\"000000000.00\"),8,1)<>1,CHOOSE(MID(TEXT(B" + row + ",\"000000000.00\"),9,1)+1,,\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\"),CHOOSE(MID(TEXT(B" + row + ",\"000000000.00\"),9,1)+1,\"Ten\",\"Eleven\",\"Twelve\",\"Thirteen\",\"Fourteen\",\"Fifteen\",\"Sixteen\",\"Seventeen\",\"Eighteen\",\"Nineteen\"))");
var formulaValue = sheet.getRange(row, column).getDisplayValue();
Logger.log(formulaValue);
// do what your want with formulaValue
...
}
RentAmount
and outputs the value in words after applying the formula? In which column ist his formula located? – ziganotschka