Downloading Search Query Data

After many years of demand by the SEO and webmaster community, Google has finally given us an API option to download search query data from Google Webmaster Tools.

For years now, the drill has been the same. Log into Google Webmaster Tools, navigate to search queries, set the parameters, date range and filters and export data. We were grateful to have an export function in the first place but the way to download data was very restricted and it still is for many things including link data. Now we have an option and it seems they are busy with enabling more. Jonathan Simon, Webmaster Trends Analyst reports on this in detail in Google Webmaster Central [1].

The Python script comes from Webmaster Tools Download Project:

To make use of this facility go to Google Data APIs Python Client Library download and install the library. Add the script to a new folder and copy the following script to it as well. (Customise it to replace the dummy values). Run the script in your Terminal:


You can see your data in Google Docs:

Search Queries API

Use to download the spreadsheet (CSV) without storing it in Google Docs. What’s great about this script is that it can be configured to regularly download and store fresh data ready for manipulation, reports and visualisation.

Watch out for security as this script contains Google account username and password stored. The script uses https as default as the first layer of protection of your data.


[1] Simon, J. – Google Webmaster Central Blog:



Dan Petrovic, the managing director of DEJAN, is Australia’s best-known name in the field of search engine optimisation. Dan is a web author, innovator and a highly regarded search industry event speaker.

More Posts - Website