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)
Once you've set up your API to Google Sheets connection, click Save And Run to get data to your spreadsheet.
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.
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.
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")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With