Unleash the Power of Image Annotation: Integrating Cloud Vision API with Google Sheets and Forms: GAS114

Introduction

This project integrates Google Cloud Vision API with Google Sheets and Google Forms. Using image annotation, it can identify labels, detect text and colors within images stored on Google Drive or those publicly available online. This demonstration showcases the most common uses of the API; a full list of features is available for those interested in exploring further.

YouTube

For visual learners, a comprehensive video explaining the details is available for your convenience.

For exclusive content and early access to my videos, please consider subscribing to my YouTube channel.

Subscribe

Demo Form

You can use this Google Form below to submit a test image along with your email address. The script will analyze the image and send an email containing the identified labels, text, and colors.

https://forms.gle/trxb4vkVFRNcLfdY6

Instructions (4 Steps)

To establish your own project, adhere to the following steps:

Step 1

Utilize the provided link to create a duplicate of my project in your Google Drive.

Make a copy

Note: The Google Form associated with my Google Sheets will not be copied. You will need to create your own Google Form and link it to the copied Google Sheets.

Step 2

Create a Google Cloud project with Cloud Vision API enabled and connect it with the Apps Script project.

* To use the Cloud Vision API, you must link a payment method to your account. If you haven't done this before, please follow the guide below.

A Complete Guide to Setup GCP for GAS

Step 3

Complete the authorization requirement by clicking the button “Image annotate” from the menu “GAS114” in the copied Google Sheets.

* If you are not familiar with the authorization process, you can check this guide below.

A Complete Guide to Authorize GAS Project

Step 4

After you have successfully authorized, you will be able to access the image annotate script and analyze an image uploaded from the connected Google Form.

Google Sheets Integration

Click the “Images Annotate” button to run the script after you have prepared image data in this sheet. The results will be displayed after the script finishes annotating the images.

Image URL (*): A URL for an image that is either publicly accessible or stored in your Google Drive (if stored in Google Drive, ensure the URL contains ?id=).

Preview: This formula simply displays the image within the sheet.

Labels: It can be used to specify the desired number of labels for annotation and also to display the number of labels in the results.

Text: It serves both as an input, determining whether text detection is necessary for the image, and as an output, displaying the results.

Colors: It serves as both an input and an output for the detected colors, defining the colors to be identified and returning the identified colors.

Status: Status message indicating success or failure.

Google Form Integration

The form was created with a field to collect email addresses and a file uploader for image processing.

A developer section is required to save the script results; however, this will not be visible to users as the form is submitted after the image uploader.

After creating the form and connecting it to Google Sheets, install the "GAS114" trigger from the menu. This will allow the script to process images uploaded through the form.

The trigger can be uninstalled to prevent the form from analyzing the image after installation.

Conclusion

In this post, we explored the integration of Google Cloud Vision API with Google Sheets and Google Forms. This project enables users to analyze images stored on Google Drive or publicly available online using image annotation. The results of the analysis, including labels, text, and colors, are displayed in Google Sheets and sent via email to the user. This demonstration showcases the versatility of the Google Cloud Vision API and its potential applications in various fields.

GoogleAppsScript Playlist (Subscribe for New Projects)

Links

Hire me on Upwork  Donate (PayPal) YouTube Github Twitter / X Instagram

Comments