since i have some problems in displaying iframe and scrolling it correctly in iPhone browser, i am looking for a way to put the html code of the script directly in my website page. so can i copy the index.html code from the script and put it in my hosted website? if no, is there any alternative way? thanks for any help. [beginner]
Asked
Active
Viewed 275 times
0
-
You can just deploy it as a webapp that runs in your browser. – Cooper Dec 22 '19 at 22:43
-
yes for sure deployed it as web app and got the URL of the script and embedded it in iframe [this works well]. – user3140792 Dec 22 '19 at 22:48
-
in another way, can a google app script run from external website html file? the script contain doGet and doPost functions to play with data in google sheet. – user3140792 Dec 22 '19 at 22:50
-
You don't have to embed it as an Iframe in your website. You can run it as a website in your browser. – Cooper Dec 22 '19 at 22:56
-
thank for your help, i don't want to redirect the client into anther page and i want to keep the URL of the script hidden. would the following make sense: `function doGet() { return HtmlService.createHtmlOutputFromFile('www.mywebsite.com/index.html'); }` – user3140792 Dec 22 '19 at 23:13
-
I don't think so, but why ask? Just try and see what happens. One thing for sure is that Google won't like getting content from an unsecure site. – Cooper Dec 22 '19 at 23:21
-
i think i have to authorize the external domain to talk with the app. By the way nice Bike riding! and thanks in advance. – user3140792 Dec 22 '19 at 23:27
-
I've never tried it. If I want something on a website I iframe it. – Cooper Dec 22 '19 at 23:36
1 Answers
3
You can POST
from your website and receive it in doPost()
> execute a Google script function and return information back to your website.

TheMaster
- 45,448
- 6
- 62
- 85
-
Thank you for the answer, can you please give some few steps to do this? – user3140792 Dec 23 '19 at 20:05
-
@user Don't think I can. If there's a specific thing you want clarified, I'll be glad to clear it out, but there's nothing more other than those two steps: Post from your website> receive it in doPost(). Also, if you're looking for samples, click [here](https://stackoverflow.com/search?q=%5Bgoogle-apps-script%5D+user%3Ame+post+from+web*) – TheMaster Dec 23 '19 at 20:13
-
Thank You the Master. it works! but how to protect my spreadsheet to be only accessible from my domain name. – user3140792 Dec 23 '19 at 21:13
-
and i can post the data but how to get data from the sheet to the web? – user3140792 Dec 23 '19 at 22:37
-
@user314 If you return a value from `doPost()`, it'll be received in web, provided your web app is published as anyone, even anonymous. This [question](https://stackoverflow.com/q/57911167/) might help, if you don't want anonymous access to your sheet. If you still have issues, It'll be better to ask a new question with your current code. See [mre]. – TheMaster Dec 24 '19 at 06:45
-
Done. Thank you https://stackoverflow.com/questions/59474081/how-to-return-specific-data-from-a-google-apps-script-into-html-web-page – user3140792 Dec 25 '19 at 01:00