google-apps-scriptweb-applicationsfile-management

Elegant way to store resources (icons, images etc) for a Google Apps Script webapp


Now that it is possible to make non-container-bound webapps, it would make sense to be able to put the app's resources (e.g. some icons and images, perhaps a legacy database etc) into the app - perhaps in a similar way that you can add further .gs files to a project. This would mean they don't have to be uploaded to some external service and then referenced, and the web-app would be self-contained. Is there already a way to do this, or should I put in a feature request?


Solution

  • What works quite well for me is putting the Google Apps Script into a folder within Google Drive and adding all other resources to that folder. You can then link to them directly by using the download link if you share them with anyone having the link.

    E.g. a file with ID ID can be linked to via https://docs.google.com/uc?export=download&id=ID. You can even link to certain revisions (click right on the file in Google Drive and open the revisions dialog to find out the revision key, then add &revid=REVISION_TOKEN to your URL).

    Its not 100% self-contained in a sense you can just copy all resources over somewhere and have it working in a dash, but the beauty of this solution is that the hosting is provided by Google and is most likely to have about the same availability as your Google Apps Script as well.