Developing in an App Backend vs. Script Project?

31 views
Skip to first unread message

Davis Jones

unread,
May 9, 2019, 2:03:56 PM5/9/19
to Google Apps Script Community
Hi there,

I'm wondering--when you're building your Google Apps, do you prefer to develop in the back-end of a particular service (e.g. Sheets, Docs, etc.) or in a standalone Scripts project?

Thanks for your thoughts,

Davis

Alan Wells

unread,
May 9, 2019, 3:01:38 PM5/9/19
to Google Apps Script Community
Stand Alone scripts can't test event triggers.  So, if you develop using a bound script, then you can test the triggers.  It was previously difficult to find scripts bound to documents.  People would forget where their scripts were, and have many documents, and not know what script was bound to what document, and they wouldn't be able to find their script.  But, now you can see a list of all bound and stand alone scripts in your

page.

I would still not publish an add-on from a bound script though.  Which means that you need some way to transfer your code out of the bound script to a stand alone script for purposes of publishing the add-on.  And if you don't want to copy and paste, that means that you needs to use clasp, or the Chrome extension Apps Script Git Hub assistant


I've recently changed to developing add-ons in scripts bound to documents because of the situation with testing the triggers.

Reno Blair

unread,
May 9, 2019, 3:41:46 PM5/9/19
to google-apps-sc...@googlegroups.com
I think you can still create those triggers for your test document from any script:

var myTestDocument = DocumentApp.openById(docId);
var functionName = "onDocumentOpen";
ScriptApp.newTrigger(functionName).forDocument(myTestDocument).onOpen().create();

--
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/d15d0737-638b-4ce2-aa8b-7f00c5fbaf8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Reno Blair
Educational Technology Services​

Alan Wells

unread,
May 9, 2019, 4:37:21 PM5/9/19
to Google Apps Script Community
I always get the active document, instead of getting a document by ID.  If the code gets a document by ID, then I'd need to remember to change the code before publishing.  And I do need to check some things before publishing publicly, but I try to make everything as generic as possible.


On Thursday, May 9, 2019 at 3:41:46 PM UTC-4, Reno Blair wrote:
I think you can still create those triggers for your test document from any script:

var myTestDocument = DocumentApp.openById(docId);
var functionName = "onDocumentOpen";
ScriptApp.newTrigger(functionName).forDocument(myTestDocument).onOpen().create();

On Thu, May 9, 2019 at 12:01 PM Alan Wells <aj.a...@gmail.com> wrote:
Stand Alone scripts can't test event triggers.  So, if you develop using a bound script, then you can test the triggers.  It was previously difficult to find scripts bound to documents.  People would forget where their scripts were, and have many documents, and not know what script was bound to what document, and they wouldn't be able to find their script.  But, now you can see a list of all bound and stand alone scripts in your

page.

I would still not publish an add-on from a bound script though.  Which means that you need some way to transfer your code out of the bound script to a stand alone script for purposes of publishing the add-on.  And if you don't want to copy and paste, that means that you needs to use clasp, or the Chrome extension Apps Script Git Hub assistant


I've recently changed to developing add-ons in scripts bound to documents because of the situation with testing the triggers.

On Thursday, May 9, 2019 at 2:03:56 PM UTC-4, Davis Jones wrote:
Hi there,

I'm wondering--when you're building your Google Apps, do you prefer to develop in the back-end of a particular service (e.g. Sheets, Docs, etc.) or in a standalone Scripts project?

Thanks for your thoughts,

Davis

--
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-community+unsub...@googlegroups.com.

Davis Jones

unread,
May 9, 2019, 6:09:00 PM5/9/19
to Google Apps Script Community
Thanks, AJ. I appreciate your guidance here.
Reply all
Reply to author
Forward
0 new messages