Import Google Cloud Vision API Data to Google Sheets

In this guide, we’ll walk through how to use the Cloud Vision REST API directly from Google Sheets with just an API key, using the API Connector add-on for Sheets.

Google's Cloud Vision API uses machine learning and AI to automatically classify images and detect objects like faces and landmarks, so it's a pretty cool API to dig into. We'll first set up our project, then get the API key from Google, and then set up a request to analyze images in our spreadsheet.


Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Set Up Your Google Cloud Project

  1. While logged into your Google account, navigate to and click Select a project.
  2. A modal will appear, prompting you to choose an existing project or create a new one. You can do either, but here we'll create a new one by clicking New Project.
  3. You'll now see a screen asking you to name your project. We'll call it 'Cloud Vision'. Click Create.
  4. Before we move on, you'll need to set up billing. A billing account is required in order to use Cloud Vision API, but you won't need to pay unless you use more than 1000 'units' in a month. Pricing details are listed here, and billing can be enabled by following the instructions here. If this is your first time setting up billing on a project, you'll likely be offered a free credit:

Part 2: Get Your Cloud Vision API Key

  1. From the dashboard, click Enable APIs and Services.
  2. Use the search box or scroll down the page to find 'Cloud Vision API'. Click to select it.
  3. On the Cloud Vision API details page, click Enable.
  4. Back on the dashboard, choose Credentials from the menu.
  5. Click +Create Credentials and select API key from the dropdown menu. googlecloudvision-apikey
  6. Congrats, you have your Google Cloud Vision API key! Copy this and keep it safe, we'll need it shortly. You can also restrict your key via this page, to prevent unauthorized use (recommended).

Part 3: Pull Google Cloud Vision API Data into Sheets

For this example, we'll run annotation and detection for this image from Wikipedia. Substitute in your own API key where it says your_api_key, and your own image URL, if you like.

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following:
    • ApplicationCustom
    • MethodPOST
    • Request URL
    • Headers:
      • Content-type: application/json
    • Request body: {"requests":[{"image":{"source":{"imageUri":""}},"features":[{"type":"LABEL_DETECTION","maxResults":10}]}]}
  3. Create a new tab and click Set current to use that tab as your data destination.
  4. Under Output Options, change the report style from 'default (single row)' to 'grid'. For this API response, the output is more readable on separate rows. You can read more about report styles here: Report Styles.
  5. Name your request and click Run. A moment later you’ll see an analysis of your image in Google Sheets:

Part 4: Get More Cloud Vision API Data in Sheets

  • If you'd like to analyze URLs more conveniently, you can use cell values in the request body. For example, here I've added the URL to cell A1 in the sheet ImgURLgoogle-cloud-vision-img18

     I can now reference it by substituting in +++ImgURL!A1+++ instead of the full URL:


  • If you want to analyze multiple images in a single call, add them into the 'requests' array like this: {"requests":[{"image":{"source":{"imageUri":"+++ImgURL!A1+++"}},"features":[{"type":"LABEL_DETECTION","maxResults":5}]},{"image":{"source":{"imageUri":"+++ImgURL!A2+++"}},"features":[{"type":"LABEL_DETECTION","maxResults":5}]}]}

Part 5: API Documentation

Official API documentation:

Official how-to-guides:

2 thoughts on “Import Google Cloud Vision API Data to Google Sheets”

  1. Could you reference where we could scan a google drive folder? Looking to analyze 1000+ images for text and looking how to do this.

    • Hey Nik, the end of the article shows how to analyze multiple images in a single call. I believe your Google Driver folder would need to be public.


Leave a Comment

Jump To