⚠️ This lesson is retired and might contain outdated information.

Retrieve And Tweet Information from Google Spreadsheets

Hannah Davis
InstructorHannah Davis
Share this video with your friends

Social Share Links

Send Tweet

In this lesson, we’ll learn how to retrieve and tweet data from Google Spreadsheets. We'll use Tabletop.js to make this easier. More information on Tabletop can be found at https://github.com/jsoma/tabletop.

[00:00] In addition to Twit, we'll need Tabletop, which is require ('tabletop'). In the Google spreadsheet we want to use, we need to make sure we have a header, which in this case is the URL of an interesting API resource.

[00:13] We need to say file publish to the Web. We press "publish," and then copy this link. Here, we'll say parse spreadsheet URL= this link. Then we say table top.init. This takes three things. A key, which is our spreadsheet URL, our callback function, which is data, tabletop, and whether or not it's a simple sheet, which is true if we only have one sheet.

[00:49] Let's see what that gives us. We can see a couple of APIs from this course. We can see ProgrammableWeb, which is an excellent resource to find other APIs, as well as ProPublica, which hosts an API of Congressional actions, including bills, votes, roll calls, etc.

[01:05] To tweet these, we can say data.for each.post statuses/update with a status, which we'll make up here. It's d.url is a great API to use for Twitter bots. There's an error, we'll log it out. Otherwise, we'll say post in. We can see that it worked.