function main() {
var scriptName = "INSERT_SCRIPT_NAME_HERE";
var scriptText = getScript(scriptName);
if (scriptText) {
Logger.log("Running script: "+scriptName);
eval(scriptText);
var script = eval('new '+externalScript+'();');
//function call for external methods
script.main();
script.nextFunction();
//insert other script logic here
}
}
function getScript(scriptName) {
var fileIterator = DriveApp.getFilesByName(scriptName);
if (fileIterator.hasNext()) {
var fileCheck = fileIterator.next();
if (fileIterator.hasNext()) {
Logger.log("Error: There is a duplicate file with name "+scriptName+".");
}
return file.getBlob().getDataAsString();
}
else {
Logger.log(scriptName+" not found.");
return;
}
}function externalScript() {
this.main = function() {
//Code here will be executed
Logger.log('Main function.');
}
this.nextFunction = function() {
//Code here will be executed
Logger.log('Next function.');
}
}