Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Apps Script How to link to JS or CSS file on Google Drive

Can I keep style.css or anyscript.js hosted on a folder on Google Drive and then include the script with a link to the file in Drive? If so.. how?

And here I mean GAS for use on Google Sites... so the script is not located in Google Drive

like image 403
Lisa-Marie Avatar asked Feb 27 '13 10:02

Lisa-Marie


People also ask

How do I link CSS and JavaScript files?

To link a CSS file with your HTML file, you have to write the next script on your HTML file inside the head tag. To link a Js file with your HTML, you only have to add the source of the script inside the body tag or outside; it doesn't matter.

Can I use JavaScript in Google App script?

Google Apps Script is a rapid application development platform that makes it fast and easy to create business applications that integrate with Google Workspace. You write code in modern JavaScript and have access to built-in libraries for favorite Google Workspace applications like Gmail, Calendar, Drive, and more.


2 Answers

Google seem to have changed it.

At the time of writing, a link to the raw data works with the following link format:

https://drive.google.com/uc?id=YOUR_DOCUMENT_ID

like image 104
Ursus Avatar answered Sep 21 '22 02:09

Ursus


UPDATE: As of August 31, 2015 this technique has been deprecated by Google.

Google recent made it possible host a file publicly on Google Drive:

  1. Create a folder in Google Drive
  2. Put any files you want to access publicly in the folder
  3. Share it publicly (needs to be "Public on the web") and copy the folder ID from the "Link to Share". For example, the folder ID from this link: https://docs.google.com/folder/d/0B5AR8ct5SZfSTDZTQjNNVXR4RWM/edit ... is: 0B5AR8ct5SZfSTDZTQjNNVXR4RWM
  4. The URL for each file will be https://googledrive.com/host/ followed by the folder id followed by the filename. For example: if you saved style.css in the folder in step #1: https://googledrive.com/host/0B5AR8ct5SZfSTDZTQjNNVXR4RWM/style.css
like image 30
Weehooey Avatar answered Sep 22 '22 02:09

Weehooey