In your special apps app, you can use google built-in spreadsheet formulas as follows:
Suppose you want to use the function =WEEKDAY() on cell A1.
Then get your active table as in your custom appscript function:
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("YOUR_SHEET_NAME");
set the formula as follows:
sheet.getRange("A1").setValue("=WEEKDAY()");
Also, if you want to convert 0.1, etc. Sunday, Monday ... then define an array like this:
var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
And then use:
var dayIndex = sheet.getRange("A1").getValue(); Logger.log(days[dayIndex]);
You can view the logs using ctrl + enter or by going to view-> Logs in script.
Shyam kansagra
source share