2

With Google Apps Script, we need to create the HTML and its JavaScript within the Apps Script project itself. I was wondering if there is a way where I can get the HTML from another server?

Basically, the idea is to reuse an existing HTML/JavaScript file which was developed for a non-appscript project and make relevant changes so as to support appsScript.

I don't want my HTML file to be part of the Google Apps Script and instead will be served from an external server. How can this be achieved?

1 Answer 1

3

You could load the external files using client-side code or server-side code.

  • To use client side code use XMLHttpRequest(), jQuery, <script src="..." />, etc.
  • To use server side code use UrlFetchApp Service to get content from a URL.

Related

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

2 Comments

Thanks for your reply Ruben. Going further, lets say I get my HTML/JS from another server. In the JS file, I might have to call a server-side function which populates a spread-sheet. Ideally, I will have to use google.script.run.functionName(). functionName would have to be in a .gs file in the apps-script project. Right? Can this function or the .gs file also reside in the remote server? Basically, what I am trying to achieve is no code or minimal code to reside in my apps-script project and rest everything should be served from a remote server. Is this possible with apps-script?
@Ekalavya What about if you try that and share with us your findings?

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.