Docs | Tutorial

In this tutorial, you will create a histogram of the annual gross profit of Microsoft Corporation in Google Sheets. You will use GetGaap APIs to import the financial data Microsoft reported to the Securities and Exchange Commission (SEC) into Google Sheets.

The tutorial takes less than three minutes to complete.

Google Sheets Chart

The GetGaap Account

The Management Dashboard

The GetGaap management dashboard provides you with an easy starting point to build GetGaap API requests to obtain financial data.

GetGaap Dashboard

In this tutorial, you will use the Histogram API to access a time series representing Microsoft's annual gross profit over a few years. Click the Build button within the Histogram API tile.

The Histogram API Request Builder

Use the Histogram API request builder to specify the parameters of the time series of the financial data you want to access. In particular, you can select the company and the concept (a financial metric) you are interested in. In addition, you can ask for data from a specific period to be reported annually or quarterly. Lastly, you can choose the response format: JSON or CSV.

GetGaap Histogram API

Click on the Company drop down to select Microsoft Corporation as the company you are interested in. To quickly locate Microsoft, start typing its name or ticker (MSFT) in the search box until the company shows up on the list, then select it:

GetGaap Company Selector

You can use the Concept drop down to pick one of the financial metrics that the selected company reports to the SEC. The field is already pre-populated with GrossProfit so you can leave it unchanged.

You can use the Start and End fields to define the start and end of the time span you are interested in as well as choose the annual or quarterly data. You can leave them set to 2019 and 2023, respectively. Thsi will result in a 2019-2023 time series showing annual data.

By default, the response format is JSON. You can change it to CSV if you prefer. In case of importing data to Google Sheets the setting has no effect as CSV is always used. However, at the bottom of the request builder you can see the preview of the data the API returns in your selected format.

GetGaap Data Preview

Now, go to the Google Sheets tab of the request builder. It shows the =IMPORTDATA(...)Google Sheets formula that you will use to import the data into Google Sheets. Click the Copy icon in the bottom right corner to copy the formula to the clipboard.

GetGaap Google Sheets Formula

Google Sheets

Create a blank Google Sheets document, then paste the formula from the clipboard into the A1 cell. Since the formula is calling GetGaap APIs, you may see a warning about access to external data which you need to allow. A moment later you will see Microsoft's 2019-2023 annual gross profit numbers in your spreadsheet:

Google Sheets IMPORTDATA

At this point, you are in the Google Sheets territory. You can post-process the data any way you like. For example, you can create a bar chart:

Google Sheets Chart

Congratulations! Using GetGaap APIs, you have just created a histogram showing Microsoft's gross profit over a number of years using data reported by Microsoft to the Security and Exchange Commission.

What's Next?

GetGaap provides three types of financial data APIs, each with its own request builder. Company API serves the basic information about companies, for example: address, industry, financial calendar, ticker symbol, and exchange. Snapshot API provides the snapshot of a company's financial data for a given calendar year or quarter. The Histogram API used in this tutorial lets you access a time series of a specific financial metric of a selected company, either on an annual or quarterly basis. You can read about the details the individual APIs in the API reference.

For more advanced use cases, we offer direct SQL access to the data. This allows you to compute custom aggregates or indices and run advanced analytical queries over 100+ million data points in our financial database. Please contact us for more information.

47 Chapters LLC © 2024