Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Spreadsheets: Is there a HTTP request function?

Does Google Spreadsheets have a cell function that lets me do HTTP requests like

POST the contents of this cell to http://www.mysite.com/input or

GET the XML at http://www.mysite.com/feed.xml

?

Or can I write a custom function that does so? Or is there a more conventional way of doing what I want to do? (using Spreadsheets to talk to REST APIs)

like image 336
themirror Avatar asked Jun 11 '13 23:06

themirror


People also ask

Can Google Sheets pull data from an API?

Once you've set up your API to Google Sheets connection, click Save And Run to get data to your spreadsheet.

How do you make a GET request to Google Sheets?

To make a GET request, make sure your method is set to GET in the Method dropdown at the top of the Apipheny add-on. After choosing the GET method, input your desired API URL and endpoint into the API URL Path field. Stacking multiple URLs will let you GET data from several URLs or endpoints in sequence.

Can Google Sheets call an API?

We can connect a Google Sheet to an API and bring data back from that API (e.g. iTunes) into our Google Sheet using Google Apps Script. It's fun and really satisfying if you're new to this world.


1 Answers

For getting contents of a cell to your website use the Google Spreadsheet API. Here you can find a simple example of retrieving JSON feeds from Spreadsheets Data API: https://developers.google.com/gdata/samples/spreadsheet_sample

Since this link may be moved due goole updates here's a copy of the script element:

http://spreadsheets.google.com/feeds/feed/key/worksheet/public/basic?alt=json-in-script&callback=myFunc

... where feed is the type of feed, key is the key of the spreadsheet you want to retrieve, the worksheet is the positional or unique identifier of the worksheet, and myFunc is the name of your callback function that is passed the JSON object.

For getting XML from a web ressource use the function: IMPORTXML(URL; XPath) e.g. importXML("http://www.example.com/feed.xml";"/path/inXML")

like image 185
Mister Vanderbilt Avatar answered Oct 10 '22 19:10

Mister Vanderbilt