I create a function "myFunction" in a google spreadsheet which could be called by user or run by Time-driven trigger. I want to display a message if it's user runs the function or log a message if it's the running by trigger.
At the moment I create this "myFunction" with a parameter (userCall as boolean) and create two others functions :
function createHistoUser() {
createHisto(true);
};
function createHistoTrigger() {
createHisto(false);
};
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Custom Menu')
.addItem('Create Histo', 'createHistoUser')
.addToUi();
};
It's not very clean I think. If there is a method to know if it's a user calling or a triggered calling I can delete the 2 functions. Thanks for your help.