Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson

Already subscribed? Sign In

Autoplay

    Retrieve And Tweet Information from Google Spreadsheets

    Hannah DavisHannah Davis

    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.

    nodeNode.js
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    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.

    Discuss

    Discuss