Google Docs Unleashed w Tom Critchlow

14
An Production Google Docs Unleashed Transcript Tom Critchlow Learn how to use Google Docs to aggregate data from the web and simplify your workflow in app testing. VP of Operations for Distilled.net www.appsumo.com with www.appsumo.com

Transcript of Google Docs Unleashed w Tom Critchlow

Page 1: Google Docs Unleashed w Tom Critchlow

An

Production

Google Docs Unleashed

Transcript

Tom Critchlow

Learn how to use Google Docs to aggregate data from the web and simplify your workflow in

app testing.

VP of Operations for Distilled.net

www.appsumo.com

with

www.appsumo.com

Page 2: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

Paul: Hi, everyone. I’m Paul Hontz from The Startup Foundry. We have Tom Critchlow here, and he’s going to teach us how to use Google Docs to just be ridicu-lously efficient. Tom, who cares what Word suite you use, or Office suite? What difference does it make?

Tom: Obviously, Excel is pretty powerful, right, and there’s loads of cool things you can do with Excel. But the key difference with Google Docs and the thing that I want to explore today is really you can fetch external web data using Google Docs. You can use scripts to schedule fetching that data. You can fetch it in batches. You can store it. You can do all kinds of processing with it. Really, for somebody who doesn’t know cod-ing, if you don’t do any programming yourself, then this is a goldmine. You can actually start to do things that previously you really would have had to write some kind of program to do before. But you don’t need to learn any real programming language. You don’t have to have a server set up. You don’t have to have a website. You can just get going straightaway.

Paul: Okay. So let’s say I’m still skeptical here. Show me something, impress me.

Tom: Okay. So let me show you what I mean. So this is a website that I built, FuckYeahSpotify. Spotify is a music sharing service in the UK and Europe. I wanted to know what are the top tweeted albums every day, and I wanted to display them in this app. That’s pretty cool, but it’s obviously going to take me a bunch of time to code this up. So actually, before I built the app, I started with this, which is just a simple Google Docs, and I’m going to talk you through everything that I used to build this in the video today.

All I do is I make a bunch of web calls to a bunch of different APIs. I use a TOP-C API to fetch data from Twitter. So I fetched the top Spotify albums. I fetched data from the Spotify API. What this does is this al-lows me to do the proof of concept for my web app without having to do the whole hog and actually build the whole app from the ground up.

This spreadsheet probably took me 10 minutes to build, maybe, and instantly I can see what the data looks like. I can say, “Oh, well, is this interesting? Is it worth going ahead and building the app?” Then, for me, this is the power of Google Docs, you can just knock something together really quickly. It’s not a

robust solution, like this isn’t the final product. But it’s awesome for just understanding does the data look any good?

Paul: Right. It’s almost like building an MVP, a mini-mum viable product, see if you can get something. Or would you disagree?

Tom: Yeah, absolutely. So I was talking with Dan Shapiro last night from Sparkbuy. He just got bought by Google. He was talking about when Sparkbuy first started, he actually paid a guy 50 bucks on Rent-ACod-er to go and fill out a mass Google Doc with all kinds of laptops and their attributes and so on. You can do a lot of that stuff with Google Docs. I either buy, like pay people to fill it out, but actually you can fetch your own data in scale using Google Docs. I’m going to show you how to do that today, and hopefully kind of walk you through. For those people who maybe aren’t full-scale developers, or even if you are a developer but you just want a really quick way of prototyping or fetching an API, hopefully this video is for you.

Paul: Great. All right. Let’s get started.

Tom: Awesome. Let’s get started. So the first thing that you care about is fetching external data. That is the kind of the basic building block that we’ve got here.

So what I’ve got here is just a simple Google spread-sheet, and I’ve put in a Twitter search URL here. If we visit this URL, we see that this is just the RSS feed for Twitter search, and you can just get this from the Twit-ter website, no authentication required or anything like that.

Paul: Do you want to quickly walk us through that, even that basic step?

Tom: Yeah, sure. So I can go to search.twitter, and let’s say I want to search for VC funding.

Paul: Okay.

Tom: But I just want to see what people are tweeting about that, so I get a results page like this. I just click on this link here for the feed. I get this URL.

Paul: Okay.

Unleashing the Power of Google Docs

2

Page 3: Google Docs Unleashed w Tom Critchlow

Tom: I copy this in here, and there’s a function called import feed. I just reference that cell that I just put the URL in. I hit go, and instantly I have a whole bunch of tweets right inside my spreadsheet. It’s right there. When I first saw this kind of thing happening, I was, like, “Whoa, wait a second.” Before I’d have to have copied and pasted. I’d have to have cleaned up the data. This does everything. It puts, like the Twitter username here in the right cell. I’ve got a link to the tweets. I’ve got the time. I’ve got the tweet contents there.

That’s pretty awesome, and I can try out all kinds of different search queries. The power here is that you already know how to use spreadsheets. People are al-ready familiar with constructing formulas and passing data, filtering data, all that kind of stuff. So this is just a way of, like you said, putting this on crack, because you can actually import web data directly into this.

This is like the basic building blocks here, the fact that you can fetch external data. But obviously this example is pretty straightforward. So why don’t we go to a slightly more tricky example?

So that was using the import feed function, but there’s another function called import XML. Let’s say that I want to get a whole list of VCs who are on Twitter, and I want to get that list into a spreadsheet. I’ve got a blog post here that somebody wrote of “100 VCs You Should Follow on Twitter.” This is pretty old, actually. It’s from 2009, but whatever. For the purposes of this example, we can use this list.

So I’ve got this list here, and historically if I want to get this list of usernames into Excel, I’d have to copy and paste, maybe it wouldn’t work so well. But instead, what I’m going to do is I’m going to use this import XML function here. Import XML is designed for pass-ing web data. So instead of fetching the entire contents of the feed, like we had before, what we’re going to do is we’re going to fetch the feed. So import XML, and then I reference this cell with the URL in, and then I’m going to actually pass the data using this XPath here.

Paul: Okay. Can you walk us through each one of those commands?

Tom: Absolutely, yeah. So XPath looks pretty scary when you start out with it, but really it’s pretty straight-forward. So let me show you what it is.

So import XML, and I’ve referenced the URL here. We put our import XML statement in quotes, in double quotes, and then the key thing here is that you want to . . . and this is obviously a very simple guide to XPath. You can read more about it in online guides. You use two double slashes like this, which basically says fetch everything defined by what I’m about to say.

So I want to fetch a div from the page, but I don’t know exactly what div I want to fetch from the code. If I go back to this blog post here -- I really love Google Chrome for this because you can right click anywhere in Google Chrome -- okay, inspect elements. Okay?

Paul: Okay.

Tom: What you want to do is you see here how I can mouse over the different sections of the page, and I end up with the div class entry contents here, which speci-fies the content that I want to fetch into my Google Docs. I want everything inside that div. So we flip back to the spreadsheet here, and we say we want to fetch any div, but then we want to specify whether class equals, and then we use single quotes and we put entry content in there. Close that up, close the statement, and we hit go.

Now what that does is you can see that I’ve actually fetched the entirety of that div class into the spread-sheet, which is a little bit . . . we’ve got too much data there. So we’re pulling more than we need. What I need to do is if I come back here, what I’ve done is I just say from that div here, so this is the statement we had before -- fetch the div with the entry content. But then from that, fetch all of the links and fetch that href target.

Now this is a very common piece of code. You don’t need to worry too much about this being complicated. I worry I’ve already lost some people here, but really every single statement you’re going to write in Google Docs looks very much like this, like this is really totally standard.

You can just play around with it until you get it work-ing, but this a/@href just pulls all the links. So instead of pulling all the links from the entire page, we’re just pulling the links from the blog, from that div in the blog.

Unleashing the Power of Google Docs

www.appsumo.com 3

Page 4: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

Paul: All right. Now Tom, we have some links here that aren’t going to Twitter. How do we filter those out?

Tom: Yeah, sure. There’s a whole bunch of differ-ent ways of filtering them, and this comes back really to the kind of simple formula manipulation that you might be familiar with from Excel. So we can just do a simple if statement. We can just say, if finds Twitter then . . . whoops, sorry; even I make a mistake some-times. We can just drag that formula down, and now you see that it only plucks out the ones that start with Twitter. We’d have to do a little bit more filtering to get rid of these values, but once you’ve got the data in here, you can filter it and manipulate it however you want. But you can see how fetching the data is as simple as cleaning up the data in Excel or Goggle Docs. In fact, cleaning up the data here might be slightly more chal-lenging than fetching the data, but that’s still an easy task.

Paul: Okay.

Tom: So how could a startup leverage this? I mean, we’re looking at this example to pull in some Twit-ter usernames from a site. Can you think of a specific example that maybe you’ve used or you’ve heard of, of a startup being able to pull in data like this that other-wise would have taken just a long time?

Tom: Let me think of a specific example. Well, so let me skip ahead to one of the examples I’ve got later on. This example that I want to show you just in a sec fetches the price of a particular product from Amazon, and you can schedule that to fetch it every day, and I’ll walk you through how to do that in a sec.

But this kind of example could be great for a startup who wants to keep an eye on their competitors’ prices. I know that in the startup world people can get quite fiercely competitive, so that might be one example of fetching data you might not otherwise be able to fetch.

Also, using this you might be able to fetch a whole lot of blogs from a particular blog directory to do out-reach. Startup marketing is a very hot topic, and people always ask how do you get your product out there? How do you get your first 100 users? How do you get covered those first few times before you’re famous?

Really it’s hard work, right? You’ve got to reach out to these people, but maybe this would be a great way to find either Twitter accounts or blogs or generally people to reach out to. Let’s say whatever niche you’re in, if you just do a Google search for top blogs in that niche, you’ll find blog posts exactly like this that list blogs in that niche. You can just go fetch all those blogs in your spreadsheet. It’s not magic. That’s not going to get you the exposure, but it saves you a little bunch of time. That’s really what we’re about here, just kind of creating those quick efficiencies to save you either do-ing something by hand, or to get you a bunch of data that you might not have otherwise been able to get.

Paul: Okay, great. So this is just saving a ton of time?

Tom: Yeah.

Paul: Okay. All right.

Tom: Cool. So I’ve got another example lined up here. This idea is we’re starting to fetch external data into our Google Doc, but there’s a whole bunch of different ways of fetching data into a Google doc, and I want to show you that you don’t have to just use it us-ing the functions that they’ve defined.

So this example here, the Facebook graph API is really easy to use and manipulate. Again, don’t get scared if you’re not a developer. I wasn’t a developer when I started using this, and it’s really totally simple. So this is JSON here. It might sound like a very developer term, but really you can see what’s going on here. I’m just querying the Facebook graph API for the AppSu-mo URL. You can see that it’s telling me that it has 881 shares. It’s simple to understand.

Paul: Right. Just to show off how you would change what site you were searching there, would you change the end of the URL there and put in another site as an example?

Tom: Yeah, sure. So I could put in the Distilled web-site in there, and you can see we’ve got 43 shares. This is a new website; go easy on us. But yeah, you can plug in whatever URL you want there, and you can see this data change.

You can fetch this data however you want. You could just go and fetch a bunch of URLs, type them in by

4

Unleashing the Power of Google Docs

Page 5: Google Docs Unleashed w Tom Critchlow

hand, copy down the results. It wouldn’t take you too long. But I hate that idea of wasting time doing stuff. So let me show you how to fetch that data in Google Docs.

What we’re going to start using here is the Google Docs scripts, which you can access in the tools menu. Google Docs scripts are quite a lot like Excel macros that some of you might be familiar with. It’s basically just a way of writing a small snippet of code that let’s you automate something or do something repeatedly.

When you hit the scripts menu, you’ll end up with something like this. It’s just a blank function called “myfunction,” and this allows you to write your own versions of things like import XML, import feed, these things that are already defined by Google. You can write your own versions of these.

Here’s one that I’ve written already to fetch Facebook data. I’ll sort of walk you through this real quick. The function is defined here, and it takes one argument, which is the URL. Again, if you’re not a developer, don’t be put off by this. It really doesn’t take very long to learn how to do this stuff, and there’s great documentation on the Google website that talks you through how to do this stuff.

All I’m doing, as you can see, this URL [email protected] and then the URL, and I’ve got the graph URL here. Then we just plug in the URL on the end that we defined in the function. This will all become clear in a sec. Then I’ve got a JSON object, and then that object, I just pull the shares attribute from it using this dot notation, so objects.shares. If you come back here, just pulls from this object the shares, attributes. I just pull that number into the function, and you can see this here just returns that to the spreadsheet.

So let’s see this in action because that really explains it. So what we need to do is, we need to call this fbshares function that I’ve defined and pass it URL. So if we just put in here =fbshares, and then reference the AppSu-mo URL, it comes back with the number of Facebook shares right out of the Facebook graph API.

Paul: Okay. Can you go back to that formula?

Tom: This one?

Paul: Okay. Actually, can you go back to the spread-sheet and then go to, let’s see, B2? Okay, yeah. So can you walk us through that formula again in the formula bar? So fbshares is pulling in from that function that you just wrote?

Tom: Yeah. Fbshares is defined by me. That’s the function that I just wrote.

Paul: Right.

Tom: So I could have called it whatever I want. I could have called that my AppSumo function if I wanted to.

Paul: Right.

Tom: Right?

Paul: Right.

Tom: And then A2 just passes into that function whatever’s in this cell here, which I’ve got as the Ap-pSumo URL.

Paul: Great. Okay.

Tom: I could put whatever I wanted in here. I’m do-ing some work for SEOmoz at the moment. I want to see how many Facebook shares they have.

Paul: Then you’re just changing that last little bit there to reference the URL?

Tom: Yes. For example, let’s say I had a whole bunch of different URLs. These are obviously the same here. It’s dummy data. But imagine if I had a whole bunch of URLs. I could just take this function, drag it down, and it would instantly go and fetch all that data for me.

Paul: Great.

Tom: Which is saving me a whole bunch of time, rather than having to type stuff out by hand. You start to see how this stuff builds off each other. We come back to my simple web scraping here, let’s say I don’t want the Twitter handles anymore. Let’s say that I want the actual blogs of all these VCs. I could go through all these URLs. If I copy this URL here, I’ve got to paste the value rather than the source code because it

5

Unleashing the Power of Google Docs

www.appsumo.com

Page 6: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

was from a formula before. So I’ve got this URL that I found previously, and then just =fbshares.url, and then you can see how many Facebook shares they have.

You can see how you can start to build this stuff on top of each other. You can start fetching data, and then you can write your own functions to do something with this data – query it, add a layer on top; whatever. The Facebook graph API is just one API of many, many different APIs that you can use. There are literally like, I say literally, there are a lot of APIs out there that you can use!

Paul: What are some APIs that would be popular that would be useful for us to work with? What are some that you use regularly?

Tom: Oh, gee, I use all kinds of APIs regularly. What are some of my favorite APIs? I really like the Alchemy API, which allows you to do text processing. Obvi-ously, I work in online marketing and on SEO, so it’s a little bit esoteric for some of you guys. When I’m work-ing with clients, the Alchemy API has a great way of extracting keywords from text, extracting the text from a web page, and they do some very intelligent things. Their text extraction, actually, if you point a URL at this API, it will return back to you just the unique text for that page, rather than returning back all of the nav-igation and the sidebar links and all that kind of stuff. So that can be really handy if you’re trying to fetch a whole bunch of different pages, get the text from them and then do something with that text. Maybe you want to pull out common keywords or analyze it for whether there are any links in there, any of that kind of stuff.

This is a cool API that I’ve been playing with recently. The Hunch API is awesome. You guys are probably familiar with Hunch. They do this kind of recommen-dation service.

There is the Google Social Graph API, which is really cool. The Google Social Graph API returns you all kinds of connections given a node. So you can pass the Google Social Graph API, like a Twitter username, and then it will return back to you all of the people that are connected to that account.

This is the web interface for the Google Social Graph. If I just put in my Twitter handle, and then everything returns back. You see how before this looked a little bit

like the JSON we had before, with the Facebook graph API?

Paul: Mm-hmm.

Tom: It’s exactly the same deal going on here. We’ve got JSON here. We’ve got more data. We’ve got crap-loads more data, but getting that data out of this JSON is exactly the same as fetching it from the Facebook graph API. You can get that data into Google Docs in exactly the same way that I just showed you. So given a particular Twitter handle, you can find out what URL I link to. You can find out what related accounts I have. So you can find my Yelp account, you can find my Google Profile account, you can find my Posterous, you can find all kinds of other stuff in here. So that’s a pretty neat API for analyzing connections between social graph points.

But really, there are APIs for everything under the sun. It really depends what you’re trying to do. There are so many different uses for APIs that I can’t really cover all of them, but hopefully, what I’m trying to get across in this video is the idea that you don’t have to be a developer to be fetching APIs and to get your MVP up and running. You don’t necessarily have to stick it on a server somewhere. You can start fetching data just using Google Docs, because they’re pretty powerful.

Paul: Great, okay. Sorry, I kind of wound you up there and got you all over the place.

Tom: Oh, yeah.

Paul: Let’s bring this back in here for this section.

Tom: Sure.

Paul: Is there anything else that we need to know, like as far as the basics go, to start playing with this?

Tom: Yeah. So there are a few more things that I want to kind of talk you through.

Paul: Okay.

Tom: The next thing that I want to talk you through is this simple example here. I’ve got a hypothetical situ-ation here where we have a competitor’s product, right?

6

Unleashing the Power of Google Docs

Page 7: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

Paul: Okay.

Tom: Now what I’m using here is “The Complete Seinfeld Series” on Amazon, for want of a dummy webpage that has a price on it. But want I want to do is I want to fetch this price, and I want to fetch it every day. I want to store it in a Google spreadsheet, and that’s going to let me do all kinds of things.

This could be a competitor, so you might want to just have that historical price data in a spreadsheet. It might be that you actually want to buy the complete series of Seinfeld, so you want to alert yourself when that price drops below a certain point. Whatever it is you want to do, there are many applications, but the basic prin-ciples here I want to walk you through are fetching this data regularly at a given time interval and then doing something with that data.

So first things first. We’ve got the web page here. Going back to Google Chrome, we inspect element to try and find out what the code looks like for that price. Here, right? We can see that we can hone in on this price window here, and we see that we are in a table, which is class = product, and we’ve got a bold tag here with class = price large.

So what we’re going to do is we’re going to go straight back to our spreadsheet here. First things first, what I tried here with just importing XML for the page, like you saw earlier, and then just fetching the bold tags, with class = price large. But you see that that actually fetches me two results here, and if we go back to the page, it’s actually fetching this price as well, because that’s coded into the same markup as this price. But we just want this main price on the page, so what we do is refine this statement here to say only fetch the bold with class price large, and only fetch it from the table with class/product.

Paul: Okay.

Tom: Okay? This is basically the exact same situa-tion as we had before where we’re fetching data from a webpage. We just need to hone in on the particular HTML tags wrapped around the data, and then fetch it into the spreadsheet. So the spreadsheet here is pulling the price of the Seinfeld Box Set, and then all I’ve done here is just swapped out that dollar sign so I just have the raw number in the cell. That’s going to be handy in

a sec.

So this is nothing new. We’ve not seen anything new here yet. But what I’m going to do is I’m going back to the script editor, and I’m going to look at this. So now what we’re going to do, it’s all very well fetching data, writing a script in Google Docs, but one of the power-ful things that you can do with it is actually manipulate the cells using these functions. So you see how now I’ve written this function Amazon price. It’s just three lines of code, and it doesn’t take any input. I’m not passing any variables through this function, which means that I can actually run this function Amazon price from this console. I can run it independently of the data I pass through it. What it does here is it actu-ally gets this cell, which is actually cell 24). It gets this cell here.

Paul: Okay.

Tom: Then it gets another cell, and it sets the value equal to the cell we just found. So let me show you. I’m just going to hit this run button here on Amazon price, and you can see that what it’s done is it’s copied that data and put it over there.

Paul: Got it.

Tom: So this is nothing magical, but this is going to be a crucial building block for things to come.

So now that we have the kind of price bin fetched in here, I want to show you this next script that I’ve writ-ten. This is almost the same as the previous scripts. I called it Amazon Price 2. What I’m going to do is I’m just going to delete that. I’m going to put the number one in here. This is like a dummy variable I’m just going to have in this cell, which means that this is the first time the script has been run. Then what I’m go-ing to do is I’ve written this script here and it gets the price, but it also gets this variable that I’ve put in the spreadsheet, and then it updates that variable after-wards.

So if I run this Amazon Price 2 function, I click run, you can see it puts Day 1 and the price, and then it’s updated that variable to be number 2 instead of num-ber one. What this allows me to do now is, when I come back to this, if I run it again . . . let me move this so you can see it in action. I’m just going to hit run

7

Unleashing the Power of Google Docs

Page 8: Google Docs Unleashed w Tom Critchlow

again, and you can see that it adds Day 2 and it updates that again.

So I can just keep running this as many times as I want. It’s just going to run over and over again. Ob-viously, this is not that useful because the price isn’t changing very much. But the key thing now comes when I go to the triggers menu in my Google scripts, and I go to the current script triggers. I’ve got no trig-gers set up, but you can set these triggers up to actually run your scripts at a predefined time or action that you want.

You can either say, like, when the spreadsheet is opened, when the spreadsheet is edited, or when a Google Docs form is submitted to the Google spread-sheet, you can specify a function to be run at that time. Or, importantly, you can make it time driven. This is the function that I love.

So now you’re starting to see this come together. We take this Amazon Price 2 function. We select it as time-driven, and let’s say we want to run it every day at noon. I just save that up, and now, instantly, this script is going to run every day at noon. It’s going to fetch the price of this Amazon product, and it’s going to put it in a new cell here. This is just going to keep growing and growing and growing. Every day it’s just going to put that data in there.

I can log in whenever I want, and I can check it out. I could chart that graph over time. I could do whatever I wanted with that data. What I’ve actually done here, not only am I storing the data in the spreadsheet here, but I’ve actually written a little function here as well. Again, this looks quite suspiciously like programming language, but again it’s very, very simple.

With one line of code here, this is one line of code, that sends me an e-mail when the price is below $100.

Paul: Wow. So there are just some real basic building blocks that you’re layering on top of each other to build this?

Tom: Absolutely. Like I say, this is a pretty abstract example. I don’t know whether you actually want to e-mail yourself when the cost of a Seinfeld Box Set drops below $100, maybe you do. But the idea here is that you can have it do whatever you want. You could

have it alert you and say your competitors’ prices have changed; or you could have it alert you and say, I don’t know, maybe you could fetch the home page of Hacker News every day, and if there’s a story on there from your competitor, it could send you an e-mail or what-ever.

There are all kinds of things you can do here. I don’t want to second-guess what you might want to use it for. I think that the real power of Google Docs is that you can just hack this together really, really quickly. This is like what, seven lines of code I think? It takes me no time at all to write it, and instantly you’ve got something which is saving data in a spreadsheet. It’s going to e-mail me when something happens. But one thing I will point out here, and one reason that you don’t want to start building necessarily really robust applications on Google Docs, is that this script might fall over at any moment. As soon as Amazon changes the mockup of that page and this is no longer in that div that I defined before, this script is going to fail.

Paul: It’s not that the script itself would fail, it’s that the external forces that you’re calling may have changed?

Tom: Absolutely, yes. So the script would still kind of do its thing, but it wouldn’t have this price anymore. This price would be like N/A or something because it wouldn’t have managed to fetch it. You could write, if you really want to, you could write a script in here that checks if there’s an error importing the data. You could send yourself a different e-mail if there was an error saying, “Hey, you might want to fix the code in the spreadsheet. It’s no longer working properly.” But at that point, I kind of feel like maybe it’s worth trying to code a real programming language. Maybe you want to go into Ruby or Python or something.

For me, the real value of Google spreadsheets is that you can just do this really quickly. It doesn’t have to take you a lot of effort or a lot of resources to hack something together like this. I can share this Google Doc with somebody. I can share it with the whole team. My team can log in, they can manipulate the data and copy and paste it into Excel. It’s very, very easy for people to understand what’s going on, how this data works, all that kind of stuff.

Paul: Okay, great. So we have the basic building

www.appsumo.com 8

Unleashing the Power of Google Docs

Page 9: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

blocks. We know how to build an MVP. How can we take this even further?

Tom: Sure. What I want to talk you through here is a real example of a spreadsheet that we use at Distilled. We use it to help our keyword research for our SEO projects. I want to talk you through how we can kind of turn this into something a bit more interactive. This is kind of going from simple data collection to some-thing that’s a bit more like a tool. We can actually start to do things with this. Like I say, none of the technol-ogy here is any more complex than what you’ve already seen. All of the web calls and the functions I’m using, I’ve already just explained to you.

Paul: Okay.

Tom: But I want to show you how we’re going to layer this up into something that’s really useful.

Paul: Great, okay. Let’s say that I’m interested in daily deals. I’m trying to figure out the best keywording, staying in line with the AppSumo stuff. Let’s build an app that will, or a formula I guess . . . well, what would you even call this, an app?

Tom: Yeah, we just refer to them as Google Docs internally, like everyone kind of knows what a Google Doc means. It’s somewhere between . . . it’s not quite an app, but it’s something a bit more interactive than just a bit of data.

Paul: Right, okay. So let’s say that I’m interested in daily deals. I want to do some research on SEO for that. Can you walk us through some of that?

Tom: Yeah, absolutely. So we built this script here, which basically uses the intelligence of eHow to iden-tify keywords that are low-hanging fruit in a particular niche. So first things first, let’s plug in that daily deals keyword in here.

Then we see that we’ve generated a whole bunch of headlines here related to daily deals, and let me explain where they’ve come from. What we do with this sheet here is we’ve got an eHow page like this. So we’ve got an internal search page on eHow for daily deals. You can see that the URL is very simple to construct. It’s nice and easy for us to swap that out, depending on whatever keyword we’re targeting at the time.

You see how on this internal search page we have all of these headlines, which are basically keyword rich. eHow only ever writes headlines that are keyword rich, because that’s their entire business model, is to write an article specifically targeted to a keyword and then rank for it.

So what we want to do is we want to spy on them. We want to spy on all these keywords that they’re already writing content for. If I flip back to the spreadsheet here, this is the URL. So we just construct the search query related to the daily deals keyword that I just put in. Then that automatically updates when you put it in on the front sheet.

Paul: So that A-1, that’s the variable.

Tom: Sure. So this is pretty much exactly the same as you would do in Microsoft Excel as well. So just a formula here to refer to the Use eHow sheet, and then we want cell, H5, which is this cell here. As soon as I type anything in there, that updates it over here. So if I wanted to write a blog post about Groupon, you can see that this instantly changes this to Groupon, and then it kind of cascades down and all these formulae instantly update in response to that.

Paul: Got it.

Tom: If we turn this back to daily deals, this import XML function here just pulls the search query page from eHow. You can see this import XML query is really simple, right? You guys should be able to write that by now. It’s just a few, like one simple function, and that pulls all this data in here. Now, there is a slight something that you need to be aware of, which is sometimes Google Docs will spread the data over mul-tiple cells, like this. This is happening basically because on the eHow page, you see how this is bolded? In the HTML source code, that breaks up the headline into multiple different headlines around the bold tags.

So all we need to do is we just need to get the data, Google Docs splits it up into different cells, and then we just concatenate that data back into one single cell over here. Okay?

Paul: Okay.

9

Unleashing the Power of Google Docs

Page 10: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

Tom: Now, we’ve managed to basically find straight-away from Groupon all of these headlines and key-words related to daily deals. Now, if we flip back to the first sheets, you see how we’re using exactly the same trick that we had before. So the first sheet just pulls those headlines in here, and then this content here is actually left over from the last time I ran this. So let me just delete that.

Okay, so now there’s this button here. I’m just going to press that button. What this button is going to do is it’s going to rank check eHow for every one of these keywords that we have here. You can see how it’s just scrolling through these keywords and just fetching the ranking position of eHow for each one.

The purpose of this, like the real use case here, is that anytime that eHow ranks number one, that’s a keyword that’s pretty easy to rank for, right? That’s my thinking behind this. If we can spy these keywords, then they’re kind of the low-hanging fruits.

So you see that, like, how to find daily deals at eBay, eHow ranks them 84, so that’s maybe like slightly competitive. But how to get great deals at American Express Daily Wish, eHow ranks number one for that. So if we wrote a blog post with that keyword, we would rank pretty much straightaway. You can pretty much be sure that we’re going to rank for that keyword, because we can write content that’s better than eHow, right? We don’t have to churn out millions of pieces of content like eHow does. We can just focus on a few.

You can see there are some keywords that they don’t rank for. So “last-minute Florida vacations,” well, no shit, they don’t rank for that. It’s a pretty competitive keyword. How to use Groupon, they don’t rank for that.

This is really kind of useful for us. We use this in our daily job. Let me just show you how this works. If I open up the script editor; so what I’ve done here . . . actually let me back up just a sec. When you’ve got a drawing in a Google Doc, like this, this button, you can assign a script to it, and that’s all I’ve done here. I’ve just put the name of the script in there. So this is ex-actly the same as we had before, where we can run our scripts either on a time base or when something hap-pens in the spreadsheet, when you open the spread-sheet. But you can also tell the scripts to run when you

press a button, which makes these ridiculously easy to code and easy to use.

Again, this is so easy your mom could use it. They just come in, the put the keyword in, they hit that button. It’s so easy. This script is only like 15 lines of code.

Paul: Can you walk us through this?

Tom: Yeah, sure. So this script here is basically . . . so let me walk you through where we are. This is some-thing that is worth knowing about. This sheets.getlas-trow, that basically says to this function, “Where is the last row in the spreadsheet?”

Actually, the script seems to have failed a little bit. It had gone on further down that I had intended to. But it should find that last row here in the spreadsheet. So here. Then we fetch where the end of the data is, and then what we say is we put a for statement here. We say, “While this variable is less than the last row, we fetch the term.” So we get range with this variable we just defined. So we basically cycle through each one of these cells. Then, by the way, I’m going to give you these scripts as well below the video.

Paul: Great.

Tom: So you can copy and paste them, so don’t worry about writing them down from the video. You can probably see that if you’re watching the video, what am I talking about.

Anyway, basically what you do is you get the value of this cell each time. So for each for loop, you get this keyword. Then you put the keyword somewhere like way over to the right on the spreadsheet. Then we set a formula next to it, which basically constructs the Google search query for that keyword. You can see how we’re passing into this formula whatever the key-word is that we’re trying to target right now.

Paul: Okay.

Tom: Actually, let me expand this for you, because it makes it a little bit easier to check. You can see here how we have the site that we want to rank check for here, which will allow you to rewrite this for any other site if you wanted to.

10

Unleashing the Power of Google Docs

Page 11: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

What we do is we get this, we set this formula. So each time we go through this for loop, we set this Google search query into a particular cell. Then what we actu-ally do is over here somewhere, you can see how we construct the search query here based on the keyword, and then when actually rank check for it by just using a simple import XML statement here. This actually is pulling the import XML of the Google page for that particular query.

I would very much strongly point out here that Google is quite opposed to you doing rank checking and scraping their search results, but we found that it’s okay so long as you do it in really small volume. We’re only checking a handful of keywords here. As soon as you start doing it in any larger volume, Google will start to . . . your script will stop working. So don’t go doing this like crazy. Don’t get ideas in your head and be like, oh, so I could build a like full-service rank checker off this. This is not your solution to a full-service rank checker. But for simple scripts like this it works great. We can just plug some data in.

If you really wanted to, there are third-party APIs that will let you do rank checking as well, that aren’t by Google. So you could use those if you really needed something a bit more robust, but this seems to work fine for our purposes.

So let’s go back to this script here. This script is re-ally just a few lines of code, but all it does is it cycles through these keywords, constructs the Google search query page, and then fetches that page and fetches the eHow URL from that page, and returns the ranking position.

Paul: Okay.

Tom: Then it sets the ranking position and the relevant cell here and the ranking URL. So as it cycles through, it sets all this data in there. That was kind of a little bit of a lengthy explanation, and I’m sure that you’re probably not following, like, exact step-by-step, but hopefully you can get the idea that all I’m build-ing on here are exactly the same things that I’ve been building on before, which is using the import XML function, using Google scripts, tying the two together.

I’ve got this button here which I use to run the func-tion, and by matching all of these different data points

together, I’ve just got this nice, handy tool which kind of ties everything together. This is something we actu-ally use. We plug keywords in here and we see what keywords eHow is writing about and use that for some of our long tail keyword research. So it’s pretty handy. I’ll actually give you the link to this full spreadsheet as well so you can go and see the whole thing in action for yourself.

Paul: Yeah, that’d be great. Well, thanks a lot. This is all just basic stuff that we’ve talked about before, just layered on top of each other.

Tom: Yeah, and there isn’t anything really more complex. You can do complex things with Google scripts, but you can go a long, long way with just this basic stuff. I wanted to go back to that original idea I had right at the start of the show, which was building an MVP for whatever kind of web app or startup you’re thinking of making.

We talked about this FuckYeahSpotify, which is the music service web app that I built. If we go back to this spreadsheet over here, hopefully now you can understand what’s going on. What we do here, I’ve written a script here. I’m not going to open it up, but it’s just a few lines of code that fetches the Topsy API. So Topsy has a function where you can do a site query. What this is saying, it’s showing me the top tweeted links that have this URL in them. This is basically say-ing, “Show me the top tweeted Spotify albums.” They have a great API that you can use to fetch that data. So I’ve just written a little script that will fetch that, depending on this URL.

What this does is it goes through and fetches me the top 10 Spotify albums of the last 24 hours. Then over here, you can see I’m just using import XML with this URL. To use the Spotify API, so this bit here is the Spotify API I just used that URL function, look up this Spotify URL, and it returned back the artist name and the title of the album. Then I just literally added the two together using a formula, so I’ve got a link so I can open up the Spotify album with one click if I want to, just for ease of use.

So this is how I built my original kind of idea for a web app, and I want to show you how. So this is the MVP for my next web app that I’m building. I’ve not built this yet. This spreadsheet is as far as I’ve got, and I

11

Unleashing the Power of Google Docs

Page 12: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

mocked this spreadsheet together in approximately five minutes before I jumped on this AppSumo call. So it really is super quick to do this stuff.

I blanked out my Last.fm API key, just so you guys can’t steal it. But you can get your own API key for Last.fm just by signing up. It’s free and it’s open.

So let me talk you through this web app. What I want to do here is I have this idea where I saw that Fred Wilson, the popular VC and blogger, I saw that he’s all over Last.fm. I thought, well, Last.fm has all kinds of cool things. I’ve got an account with Last.fm. I thought, wouldn’t it be cool to have a web app where you could come along, put in a username, and it would compare your musical taste to Fred Wilson, and it would give you some suggestions of artists that Fred likes that you don’t, and some suggestions of artists that you like that Fred doesn’t.

It’s just a bit of fun. I’m not going to be able to mone-tize this very easily, but it’s just something that I want-ed to think about building. But to save me time build-ing it in Python or whatever, I just built it in Google Docs in five minutes, just as a proof of concept to see what the data looks like.

You can see here, I’ve got my username here. I’ve got Fred’s username in here. Then this URL here is just the Last.fm API that I’m just plugging together with this username, this username, and this API key. I put those three things together, and then I pull back using import XML. You see how simple that import XML function is, and it just fetches this data. You can see that me and Fred like a lot of the same music. Our cor-relation is 0.86, which is pretty high. Paul, have you got a Last.fm account?

Paul: I don’t, actually.

Tom: Oh, you don’t? Okay, no worries. But let me show you, so this is, Will Critchlow is my brother, and he tends to get all of his music recommendations from me, because he’s too lazy to look up his own music. That’s why he just listens to the same music as I do. You can see that our correlation is way high, like this is off the charts, 0.9955. I should tell him to go listen to some of his own music for a change.

But what I’ve done is I’ve compared our similar-

ity tastes, but I’ve also pulled the top 50 artists that I listen to. This again is a simple Last.fm API call, using my API key and my username. It doesn’t require any authentication or anything. This is simply, I construct the URL here, and then I do the import XML call here, and then that gives me all of these artists.

So these are the top artists that I listen to. These are the top artists that Will listens to, and then this is just a simple formula that you can write in Google Docs or Microsoft Excel just to check whether this cell ap-pears in this range. So what I do for each artist that I like, I see whether it appears in Will’s preferences. If it doesn’t, then I clear the name, otherwise I give it a zero.

So you can very quickly and easily see that Will likes Daft Punk and I’m not so keen on Daft Punk. I like Sufjan Stevens. Will doesn’t like Sufjan Stevens. I see that Will likes Bon Jovi. I told you he didn’t have very good taste in music. You can plug in whatever user-name you want.

So if you come back to Fred, Fred Wilson, let’s see what we’re . . . so we have a pretty high correlation, still 0.86. We can see that he likes Belle and Sebastian. We can see that he likes Arcade Fire. Embarrassingly, I can see that Dire Straits is one of my top artists, and that Fred doesn’t listen to Dire Straits, so he’s maybe a little bit cooler than I am, but that’s fine.

Again, this is like a proof of concept. I can play around with this data and I can figure out how useful it is. I can play around with some of these calls, and once I’ve got this right, then I can go build it in Python and actually spend the time to build out something useful.

Paul: Right. So the point of this is to quickly see if . . . to prove the concept.

Tom: Absolutely, yeah. My idea might have sucked, right? I mean, my idea might still suck, don’t get me wrong. But my idea might suck, right? It might be that I could have pulled this data, and it would’ve been bad-ly formatted, or the Last.fm API wouldn’t have worked properly with these things, or maybe there would have been no overlap at all between us. But I can see that this is starting to look promising. I can see that this is starting to show me some interesting things.

12

Unleashing the Power of Google Docs

Page 13: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

Maybe what I might want to do is have some measure of popularity of these artists maybe. It would be cool to have some kind of hipster school, like how hipster is this user by identifying the popularity of these artists? Which I think you can get out of the Last.fm API. So those are some of the things that I might play around with over the next couple of days.

It’s so easy in Google Docs just to fetch this data, right? I can just do whatever I want, and if I wanted to, I could put a few tweets out, get 10 or 20 Last.fm user-names, and then plug them all in and see what their data look like. Again, I could just populate a whole spreadsheet of data if I wanted to, to see how it worked across, kind of in aggregate.

Paul: Okay. So how could someone knowing this information go out and build an MVP that would be similar in scope to this? I mean, that’s just going back and layering those simple concepts that we talked about previously, right?

Tom: Absolutely. I would say that there are really three very, very simple things that you can do with Google Docs that it’s worth understanding. The first thing you can do is you can use the import XML func-tion to fetch data from any web page. But that’s a little bit messy. If they change the HTML of that page, then the call might not work in the future or whatever. So you should only use that for the kind of really small scale stuff.

But then you can actually fetch APIs as well. Fetching APIs and fetching JSON, like I showed you with the Facebook graph, that’s pretty powerful, and for that you’re going to need to understand Google scripts. So I would say that you want to understand import XML. You want to understand Google scripts, and then you want to understand triggers. You want to understand, “Do I want to run these scripts every day? Do I want to run it when I press a button? Do I want to run it when somebody submits a form?”

Actually, submitting forms is one thing I’ve not touched on here, but Google forms are really powerful, and you can run scripts to execute every time a form is submitted. So you could do some processing on that data, including sending e-mails, like I showed you earlier. That can be pretty powerful.

I’m always annoyed that by default Google forms don’t give you a thank you e-mail. It doesn’t alert you to say, “Hey, somebody just filled out your form.” But you could write a simple Google Docs script that would do exactly that. So every time a form was filled out, it would shoot you an e-mail.

Using those basic building blocks, I would say figure out, try and find a task that takes you a lot of time, that you do over and over again or try and think of a data-set that would be cool to analyze. Infographics are really hot at the moment, and a crucial part of info-graphics is fetching data, right? So maybe you want to fetch a whole bunch of data that you could package up into an infographic. Rather than fetching that data by hand, maybe you want to scrape it off a few websites or you want to get it out of an API, that kind of thing.

So if you’re looking for ways to kind of go home and start playing with this, start using it, those are the three things. Either try to fetch some data, fetch an API, and then try and kind of get some time-based triggers go-ing on, because they’re really powerful.

Paul: Great, okay.

Tom: Just one really quick last example I want to show you is the power of Google gadgets and kind of visualizing this data. I just put the addresses of the three Distilled offices in here, in my spreadsheet.

Paul: Okay.

Tom: Then I go, insert Google gadget, insert map, add to spreadsheet, just selecting things, and then that puts right in my Google Doc, it puts a Google map with locations for the different offices.

Paul: That is really cool.

Tom: But let me show you this one, how this is kind of even more powerful. So I just hit publish gadget. It gives me some JavaScript I can copy and paste into an HTML document. So let me literally write this in front of you. Save as .html. So I just copied and pasted that code into an HTML document I just wrote. This Google Doc, you can put in on a blog post, you can put it on a web page, and it’s got all of this information in it. So on top of the fetching the data, there are all kinds of ways that you can visualize data as well, which

13

Unleashing the Power of Google Docs

Page 14: Google Docs Unleashed w Tom Critchlow

www.appsumo.com

I haven’t really had time to go into, but hopefully that’s useful for you.

Paul: Okay. Can you talk a little bit more about gad-gets? I saw there was some other stuff in there as well.

Tom: There are all kinds of gadgets in there. There are Google charts, which are all kinds of different ways of visualizing data, a bit like you have in Excel. There are all kinds of line charts, pie charts, all this kind of stuff, but you also have what are called gadgets, which visualize things in kind of weird ways. You can have interactive time series. You can have motion charts. There are all kinds of things in here that I don’t re-ally have time to go into detail about. You can put QR codes in spreadsheets. You can put all kind of organi-zational charts. You can make charts out of pictures of money; and then they’re all a little bit gimmicky, I think, in some senses. But the Google maps one is the most useful one that I’ve found.

Paul: Again, that’s just another layer to add on?

Tom: Absolutely.

Paul: Great. Hey, thanks a lot, Tom, for coming on here. You’ve given us some really great tools to work with, and we’re starting to see the power of being able to just layer all this stuff together.

Tom: Yeah. Thanks a lot for having me. It’s been a pleasure talking with you guys. Just one last thing to whet your appetite and show you the real potential of this stuff. This is a blog post on a script that some guy wrote that actually fetches the Google Analytics API, to fetch your Google Analytics data into a Google Docs spreadsheet, which is [inaudible 57:26] this kind of thing. This is probably slightly beyond even my pro-gramming skills in Google Docs, but anyone can use it. This is awesome to fetch this kind of data. Hopefully, I’ve walked you through some of the basics today, but the sky is the limit with this stuff. If you want to go to town, you can really build complex stuff on top of this thing.

Paul: Thanks a lot for your time.

Tom: Thank you very much.

14

Unleashing the Power of Google Docs