Answer the question
In order to leave comments, you need to log in
Hierarchy of files in a project?
On docs.google.com/spreadsheets/ I created a table with my data, then switched to the script editor. After the transition, a project was created on script.google.com tied to this table.
There is a file created
code.gsby default, but it can be renamed.
code.gs?
code.gsand the onOpen() function in it.
Answer the question
In order to leave comments, you need to log in
It depends on the runtime version V8
, STABLE
, DEPRECATED_ES5
.
For V8
the order of the files, it definitely does not matter, and not even all files are loaded for execution. Therefore, it is better to avoid this convention.
In STABLE
, DEPRECATED_ES5
the order usually depends on the alphabetical arrangement of the files, but this is not guaranteed.
What's going on with you.
One project has two files код.gs
and код2.gs
. Both have a function onOpen
. When loading the program text into the execution environment, one function will overwrite the other, and in fact only one function will be executed, because there is no other at all (it is overwritten). Which function will be overwritten depends on the environment (see above).
What to do.
One solution could be to create one onOpen function and call two others from it
function onOpen(e){
onOpen1(e);
onOpen2(e);
}
function onOpen1(e){
...
}
function onOpen2(e){
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question