Working with Google SpreadSheet
Working with Google Spreadsheet
Video Transcript
00:00Now one of the features of the visualization API enables us to load actually full-on spreadsheets now
00:08We don't want to load a spreadsheet as is because it has a lot of HTML
00:13Mumbo jumbo inside of it. So if we go into or an end the sound well see that first of all
00:18We have a specific key and you could create new charts inside of your regular Google Docs or Google Drive as it's called today
00:25And you could create a new excel sheet once you created that excel sheet
00:29All you have to do is make sure that you're sharing attribute if I click on my share that is going to be public
00:36Once it's public. Well two people could edit but who has access
00:42Well me and Oren have access to it
00:44But anyone who has the link can view that means you can't change it
00:48I could change it
00:48Which is a perfect way for you to make sure that you have a mini database even that you can use
00:53No one else could change but they could look at it if there's nothing secret about that database
00:58So we're just going to use that basically as our improv database
01:01we as long as you make sure that when you click on your share that you're sharing it with everyone and you can make
01:06Sure that the P anyone could view it only you and your friends could actually edit it
01:10But actually real users like you can't edit it that makes it safe for us and makes it safe for everyone
01:17Making sure that people can't destroy our hard work that we've created
01:21Once you have that document and you have that I do so if I just copy this link to this
01:26Document and I'll just go right back in here and we could comment down that long because we don't need it anymore because we know that
01:33Our load has been successful
01:34I'm just gonna take this link and I want to change a few things in it. First of all to reach the API
01:41I'm gonna have to move some things around
01:42I'm gonna take that spreadsheet and I'm just gonna cut that and change it where the word docs is
01:47So I'm gonna change it to spreadsheet dot. Oh, it's actually spreadsheets
01:52Google com once I'm there. It's gonna be TQ TQ
02:00TQ question mark key and then we're gonna put in our key which is all gold and after that
02:06We don't need anything else. All right, so this is our URL that we want to be using
02:09I'm just gonna comment this out so you could see that structure and I'll even paste inside the original. So this is the outcome or
02:19API link and
02:23original
02:25We'll put there just so you have it in case you ever need it again in the future
02:30This way you don't have to go into the formal documentation
02:32You just grab the document and you make sure that you take the valid ID. That's the most important part and paste it right into this structure
02:40Once you have the link the next step is actually to load it now loading it is quite easy
02:45all you have to do is create a new query and that new query is basically a object of Java of
02:53Google it's what part of the Google visualization API and the reason why we loaded in the visualization API before we started working
03:01So our next step is I'm just gonna create a new query
03:04I'm just gonna call it Q for us and I'm gonna create a new google dot
03:09Visualization
03:12Triple-check that I'm writing that word
03:14Correctly because I tend to make spelling errors and here we go
03:17I just fixed the spelling error and we're gonna take that query
03:21Do you see we created a new object and again?
03:23It's an object that we're not exposed to its actual attributes
03:26We were definitely exposed to the structure of it now
03:29What's left for us is just to send it where our query query is so I'm gonna copy that link
03:36And you know just to make this nice and clean we're gonna tell we're gonna call it
03:41spread sheet
03:44Link and really we didn't really need this but this is really just to make it nice and pretty for us and make it
03:49Let's make it um
03:51Let's call it sheet link
03:54Nice and short that way
03:56We're all inside of the screen and I'm just gonna ship send that sheet link and that's all I needed to do to the query
04:01To start loading it now
04:03Last last last thing I need to do before it's actually really gonna load it because all I did was prep it to start loading
04:09Is the last step is I want to go to that new object that I've created and I want to send it out and I
04:14Want to send it because I want to get something back and again, I'm gonna use a callback
04:18And I'm gonna use a callback. So I'm just gonna give it a name and let's kind of get on sheet
04:23back on sheet
04:26Call back
04:28Call back
04:30Alright, so I'm gonna call it on sheet callback and on sheet callback will basically be called as soon as our sheet has been loaded
04:36So time for me to create that function on sheet
04:40Call back once I have the sheet on sheet callback ready
04:44I could first I need to put inside here the response
04:48Which is a response that will come back to me once the sheet is actually loaded
04:52And now that I have that it's we're really running here. So first of all, we got our object of a data
04:59Hopefully we could test this out by you again just using the console
05:03Log and we could just list out what's the response and we could save that baby out go back into our application
05:12Go right into our document
05:14Make sure our console console is open and goes click refresh and once we click refresh and it's done loading
05:22First of all, we'll find that there's an error because we probably wrote here not response. So let me
05:27reap
05:28Reponescence, so
05:29Reese funds and I'll save that baby again and load over all over again making sure that I load my
05:42Occasions and once I did that we will finally see our object and we'll see that it has a lot of
05:47Information inside of it and we'll dig more deeply into the structure and learn how to actually capture and take the information out really soon
05:55But for now, you'll be able to see that we actually have all these different objects and they have information inside of them
06:01Which is actually going to contain also our information of the chart itself that we've just of the all the information
06:08That's inside of here wrapped inside of that query object enabling us to interact with it
06:13Alrighty, so that covers this one and we're going to move on to going into the map itself and creating it right now
