Blog

- October 28, 2015

Google Finance offers a neat integration with Google Sheets as presented in this article. Also APISpark offers to turn a Google spreadsheet into an API. Let’s combine both of them to create a dashboard that monitors in real-time the Google Finance stock quotes.

First, we create a spreadsheet “My_quotes” that contains a worksheet “Quote” where the columns have the Google Finance formulas as values.

stock-quotes1

Thus, the step to integrate Google Finance with Google Sheets is done. Now, let’s create an API from this spreadsheet.

Log into APISpark, and create an entity store. Use the type “Google Sheets Wrapper”.

stock-quotes2

Select your newly created spreadsheet. Once the store created, you only need to deploy it. Then, extract the API from it with the action “Export web API”:

stock-quotes3

Once the API created, we set public the resource GET on the collection of quotes for simplicity. Click on the resource:

stock-quotes4

Then click on the tab ‘Security’, check the option ‘Anyone’ and save:

stock-quotes5

Now, we can deploy the API.

You now have an API that exposes the data from the spreadsheet. That is a cool thing but there is still an issue to solve. As the data is automatically updated by Google Finance, you need to request the API in order to get the latest values. You can handle this by yourself or you transform your API into a real-time push API with streamdata.io! Let’s go with the second option.

Log into streamdata.io and create a new application. Then, specify your API url, for example: https://my-quotes.apispark.net/v1/quotes/
Follow the Step by step guide in order to use their API into your client application.

Here, as an example of a client application that calls this brand new real-time API, we’ve built a dashboard with AngularJS, MaterializeCSS and HighCharts, the whole being served from GitHub.
You can find the final result here and its source code there:

quotes4 quotes5

As you can see, streamdata.io enables us to call the API and react on the new values from Google Finance, in real-time.

As we’ve seen, thanks to the integration of all these great technologies, you can make data available easily, quickly and in real-time to top it all! Moreover, it allows you to focus rapidly on the client application in order to call and to present the information as you need to. Now, go play with the app!

 

See also: Create a quiz application with Google Sheets, APISpark, Streamdata.io and D3.JS by Guillaume Laforge