Is it possible to enter data into a Website via Google Apps Script? - google-apps-script

I am collecting Data via Google Forms, they go into a Google Spreadsheet.
Then I would Google Apps Script to enter the Data into a Webpage Formular.
Is this possible in anyway with Google Apps Script?
Update:
I would like to do Google Apps Script, go to a website( I don’t have control of the website, then get data from a google spread sheet and enter it into the fields then click on certain fields. I know I could to it via puppeteer. But I was thinking google Apps Script has something/sometype to interact with websites.

Not in the way you're thinking. If the target website is not secure you can "fake" a form submission on it by making a POST requesting using UrlFetchApp. But this will most likely not work on most sites.
You can use UrlFetchApp to get the target website but GAS won't render it or let you interact with it like puppeteer will.

Related

Using ApI is it possible to edit or open Google Sheet?

Using API to get access_token and now I need to open Google Sheet.
Step 1.
Authorization: Bearer ya29.a0AV...." together with link: "https://docs.google.com/spreadsheets/u/0/d/[DocumentFileID]/edit"
Step 2.
Now HTML document back (~200kb). I'm using libcurl for that.
The problem is - missing are some css and js files and I see document just partially. Is there any way to open/edit Google Sheet using API?
I know for the option to just open https://docs.google.com/spreadsheets/u/0/d/[DocumentFileID]/edit in the new browser tab, but in that case I need to manually login to Google and that's what I try to avoid, because I want to use API to login and to open/edit a Sheet.
I also know for the option to share a document but I also try to avoid that. I'm writing application to customers who can access they own documents once they confirmed API usage.
I think you may have misunderstood what the google sheets api can do
The Google Sheets API is a RESTful interface that lets you read and modify a spreadsheet's data.
It gives you access to the data, it does not allow you to open the google sheets web application. Your going to have to code your own google sheets type app if you want users to open sheets directly.

Is it possible to hide Google script from google sheet?

I have a Rest API available which I would like to make available via an Google sheet for less tech oriented people. I was wondering if it is possible to hide the google script from the sheet if I share it with people? I have some sensitive information in the code like the authentication etc which I would like to hide. Moreover, it would be nice if they can't infer with the code. Is this possible?
The only secure way is to create an add-on.
Related
How to protect the Apps Script code in a Google spreadsheet?

Google Site Script to dynamically add posts from Google Sheet

I have a Python cron job that pulls urls from sheet1 and populates sheet2 with scraped data from each url. Sheet 2 consists of [url, title, body, image urls]
I have an Old Google Site where I manually take sheet2's contents and create a new post. I want to automate this.
Structurally speaking would Google Scripts be able to pull and publish this dynamically? Lets say every time Sheet2 is updated (or a set interval).
I've worked with gscripts but never touched Google Sites before today.
The answer is probably yes. Apps script can do this. You have a couple of options.
Old Google sites
Option 1
Embed an apps script into the site as an iframe and stream you posts in that.
Option 2
Use either a standalone apps script or one attached to the google site and update the site using the Google Sites API.
New Google sites
Currently there is no apps script API for the new google sites. But you can embed JS HTML etc as a frame in the new sites. You can even use CDN libraries. Which means you can pull data from your sheet using something like AJAX.
Custom built option
The Google Sites API can be accessed anywhere you can handle Oauth. This means you can update Google Site from server-side code or from any client if you can handle Oauth.

Importing editable HTML into Google Sheets

I know how to important HTML Data into Google Sheets so that it displays, but I am trying to figure out if it is possible to also copy a web data entry form into Google Sheets, so that you can enter values, which would then be presented by the data.
I am trying to import this calculator into Google Sheets so that I can work with the real time values.
http://www.coinwarz.com/calculators/ethereum-mining-calculator
Any ideas about how I can do this?
I am not aware of any way to import the actual HTML form into Google Sheets. However, here is how I would do it:
I would open Chrome and find the outgoing POST request that occurs when you press the green Calculate button on that site.
I would use Postman to test and create the request and see if it works.
Using Google Apps Script, you can issue HTTP requests. I would re-construct the request being sent in Google Apps Script.
To make it look nicer, you can re-construct the calculator in your Google Sheet. You can recreate the calculator's input buttons as cells and then fetch those cells in your GAS code (like, hash_rate_cell.getValue()):

Using oAuth2 to send requests to Google Apps Script (i.e. GAS as google API)

I have been looking for a way to interact with my google sheets (and other services) from Excel (and other desktop applications).
For example:
I get a report from a work system and my boss asks me to update the information in the google sheets so that our site is up to date with the latest information.
What would be great (and easy for me) would be to use a VBA script in my spreadsheet to turn all my data in http requests and then do the heavy lifting with Google Apps Script in the cloud and finally updating the Google Sheets with the associated API.
When I look at the oAuth2 playground I can't find a way to enable Google Apps script, as I have successfully done so with other APIs.
(to be clear, I don't want to do oAuth2 with in GAS - which is a lot of the other questions that get raised)
Is this a hard problem or is there a solution?
There is currently no way of calling a Google Apps Script from an external program. You do have a few other options:
Import the relevant data into Google Sheets manually and use Google Apps Script to process it as needed, possibly making use of time-based triggers to handle the processing automatically.
Use the Google Spreadsheets API. Unlike Apps Script, this API is built to be called from other programs and can manipulate Google Sheets. However, it is a bit more difficult to use than Apps Script. Once data has been moved into a Google Sheet, a separate Apps Script can be used to manipulate it.