0

I've made a form that uploads files to a folder in Google Drive, but i'd like that once the file has be uploaded to show a message including a link to click on, something like this:

return "Image uploaded, please click here: https://www.google.com" ;

How do I make that https://www.google.com becomes a link you could click on?

  • To make a clickable link, you'll have to use the HTML Service to generate a dialog box or sidebar:https://developers.google.com/apps-script/guides/html/ – Tiffany G. Wilson Aug 10 '16 at 02:20
  • Right you can use HTML Service, Please Refer : http://stackoverflow.com/questions/20769149/form-and-file-upload-with-htmlservice-and-app-script-not-working?rq=1 – YNK Aug 10 '16 at 07:09

1 Answers1

0

To create a web app with the HTML service, your code must include a doGet() function that tells the script how to serve the page. The function must return an HtmlOutput object. An HtmlOutput object that can be served from a script. Due to security considerations, scripts cannot directly return HTML to a browser. Instead, they must sanitize it so that it cannot perform malicious actions. You can return sanitized HTML like this:

function doGet() {
   return HtmlService.createHtmlOutput('<b>Hello, world!</b>');
 }

The HTML service can display a dialog or sidebar in Google Docs, Sheets, or Forms if your script is container-bound to the file.

A script that creates a user interface for a document, spreadsheet, or form does not need a doGet() function specifically, and you do not need to save a version of your script or deploy it. Instead, the function that opens the user interface must pass your HTML file as an HtmlOutput object to the showModalDialog()) or showSidebar() methods of the Ui object for the active document, form, or spreadsheet.

Here's a sample code of function doGet():

function doGet() {
   var app = UiApp.createApplication();
   // Creates a link to your favorite search engine.
   var anchor = app.createAnchor("a link", "http://www.google.com");
   app.add(anchor);
   return app;
 }
Android Enthusiast
  • 4,826
  • 2
  • 15
  • 30