What is the maximum number of code lines that the Apps Script can handle for a single project?

497 views
Skip to first unread message

Rubén Rivera

unread,
Apr 25, 2019, 9:52:01 PM4/25/19
to Google Apps Script Community
Hi

There is a question on Stack Overflow about a project that worked fine with 150K code lines but it's not working with 220K code lines. 

Does anyone found a technical limit?

Do you have a self defined maximum number of code lines for a Apps Script project? Why do you choose / set it?

Cheers,
Rubén

kanshi...@gmail.com

unread,
Apr 26, 2019, 1:22:45 AM4/26/19
to Google Apps Script Community
In my environment, I have confirmed that the script with 250,000 lines worked fine. But I have no data of the maximum lines for one script (one project?). I apologize for this situation.

With increasing the lines of script, when the script is modified, the save time is long. So I separate the script using the libraries.

If you confirmed the script with 220,000 lines didn't work in your environment, I thought that the limitation might be due to the content of the script. How do you think about this?

kanshi...@gmail.com

unread,
Apr 26, 2019, 4:18:36 AM4/26/19
to google-apps-sc...@googlegroups.com
How about this consideration? I would like to report about the limitation of a project, because I investigated it by the experiment.

  • In the case of the simple script, I could confirm that the script with over 700,000 lines can work fine.
  • But it was found that when the script was changed, the limitation was changed. Namely, the error occurred even when the script lines are less than 700,000.

From this situation, I made a hypothesis that the limitation of the script might be due to the size of one project. So I investigated this by the experiment.

In my experiment, I investigated the limitation by increasing the file size as following 2 patterns.

  1. Increase only script lines.
  2. Increase only comments.

The file size was directly obtained by downloading the project as a file. In this experiment, I modified the size of "appsscript.json" to 0 bytes. The maximum size obtained by pattern 1 and 2 were 10,485,115 bytes and 10,485,206 bytes, respectively.

From above result, I have concluded that the maximum file size of a project is 10 MB.

But 10 MB is 10,485,760 bytes. It is considered that this difference might be due to other information including in the project. Because when the project is retrieved by Apps Script API, the returned values include also the information except for the source.

Rubén Rivera

unread,
Apr 26, 2019, 3:51:29 PM4/26/19
to google-apps-sc...@googlegroups.com
Thank you very much. 

I think that the limitation that is affecting the Stack Overflow OP could be caused both by a long processing time during saving and to the device not having enough resources (CPU, RAM, Internet speed, etc.). I assume that the comment lines have a lower impact than declarations and statements as the later are checked during the saving process. I also think that multi-line declarations and statements require more resources than those that use a single line.

Using a library is a good way to reduce the resources needed by each save operation and applying some principles like DRY (Don't Repeat Yourself) (actually a library is an excelente way to apply this principle) could will help to reduce the code lines.

Anyway, despite of good software development practices and having a device with a lot of resources, I'm curious about if there is a maximum size in MB or code lines for a real-life Google Apps Script projects.

Cheers,
Rubén

El vie., 26 de abr. de 2019 a la(s) 03:18, <kanshi...@gmail.com> escribió:
How about this consideration? I would like to report about the limitation of a project, because I investigated it by the experiment.

  • In the case of the simple script, I could confirm that the script with over 700,000 lines can work fine.
  • But it was found that when the script was changed, the limitation was changed. Namely, the error occurred even when the script lines are less than 700,000.

From this situation, I made a hypothesis that the limitation of the script might be due to the size of one project. So I investigated this by the experiment.

In my experiment, I investigated the limitation by increasing the file size as following 2 patterns.

  1. Increase only script lines.
  2. Increase only comments.

The file size was directly obtained by downloading the project as a file. In this experiment, I modified the size of "appsscript.json" to 0 bytes.

The maximum size obtained by pattern 1 and 2 were 10,485,115 bytes and 10,485,206 bytes, respectively. By this result, I have concluded that the maximum file size is 10 MB. But 10 MB is 10,485,760 bytes. It is considered that this difference might be due to other information including in the project. Because when the project is retrieved by Apps Script API, the returned values include also the information except for the source.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/02bc92ee-42a9-45d3-ac9c-fdc4f3d1cf85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages