1

I have a Google Apps Script function SearchFiles() which returns the download urls depending on the keyword the user provides. It is something like this:

function SearchFiles(inputValueFromUser) {


  var searchFor ='title contains "' + inputValueFromUser + '"';
  var searchForAbsString = inputValueFromUser + '.pdf' ;

  //The Rest of the Code goes here

    if(file.getName() == searchForAbsString){
    downloadURL = "https://drive.google.com/uc?export=download&id=" + fileId;
    arryOfUrls.push(downloadURL);
    };
  };

  Logger.log('arryOfUrls: ' + arryOfUrls);
  return arryOfUrls;//.toString(); //Send array of download urls back to client side JavaScript 
};

The function is returning arryOfUrls in plain text.

1) How can it be sent in hyperlink form? 2) Is it possible to open the URL automatically(start download immediately) as one clicks the respective button( on Index.html) to get the link?

2
  • No it can't be sent as a hyperlink directly (at least not as far I know). But you can have the HTML information embedded into the string (like "<a href="..."</a>"). This can be interpreted on the client side as a link. Commented Feb 10, 2016 at 6:02
  • I previously thought like this but din't try. Thanks a lot...it worked. Please post it as an answer so that I can mark it as correct. Commented Feb 10, 2016 at 6:23

1 Answer 1

1

No it can't be sent as a hyperlink directly (at least not as far I know). But you can have the HTML information embedded into the string (like <a href=downloadUrl>...</a>"). This can be interpreted on the client side as a link.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.