AppsScriptPulse

Supercharge Your Apps Script Code Reviews with Gemini for Workspace and a Simple Exporter Tool

As developers, we are constantly looking for ways to improve our workflow and the quality of our code. The recent rise of powerful AI assistants, like Google’s Gemini, has opened up new frontiers for productivity, particularly in the realm of code reviews. These tools can offer instant feedback, suggest optimisations, and spot potential bugs we might have missed.

However, there’s often a practical hurdle: providing the AI with the complete context of our project. For Google Apps Script developers, this can mean the tedious process of copying and pasting code from multiple .gs and .html files, not to mention the crucial appsscript.json manifest.

To solve this, I’ve developed a simple tool built, fittingly, with Apps Script itself. It’s a Google Sheet that lets you export an entire Apps Script project into a single, neatly formatted JSON file, ready to be added directly to the Gemini App or a Gemini Gem.

Why This Approach?

  • Holistic Reviews: By packaging every file—including the manifest with its scopes and dependencies—you give the AI the bigger picture leading to more accurate analysis.
  • Boosted Efficiency: Forget manual copy-pasting. A couple of clicks are all it takes to get a complete project export, saving you time and preventing errors.

How It Works & How to Prompt Gemini

To get the most out of your exported project file, it helps to understand its structure and how to tell your AI assistant what it’s looking at.

The JSON Structure

The tool uses the official Google Apps Script API to fetch your project’s content. The resulting .json file contains a list (an array) of File objects. Based on the official documentation, each object in the list represents one file from your project and looks something like this:

{
  "name": "Code",
  "type": "SERVER_JS",
  "source": "function myFunction() {\\n  Logger.log('Hello, world!');\\n}"
}
  • name: The name of the file (e.g., “Code”, “Index”, “appsscript”).
  • type: The kind of file it is. This will be SERVER_JS for .gs files, HTML for .html files, and JSON for the appsscript.json manifest.
  • source: The actual code or content of the file as a string.

Prompting Gemini for the Best Results

When you upload this file, you can give Gemini a simple instruction to ensure it understands the context. Here is a sample prompt you can adapt:

“Please review the attached Google Apps Script project. The JSON file contains an array of file objects, where each object has a ‘name’, ‘type’, and ‘source’. Please analyse all the files together as a single project to provide a comprehensive review.”

This prompt tells Gemini exactly how to interpret the file, ensuring it sees the appsscript.json manifest for its scopes, the server-side logic in the .gs files, and any client-side .html files as a complete, interconnected project.

Tip: For scripts bound to a Google Sheets, Docs, or Slides, to get the most accurate review, add these documents to your Gemini conversation alongside the exported JSON file to give Gemini the complete context.

Take It to the Next Level: Create a Custom Gem

To save even more time, you can embed these instructions into a custom Gem in the Gemini App. This creates a reusable ‘persona’ for your code reviews. When creating your Gem, you can provide it with more detailed instructions to focus its analysis.

Here is a more advanced set of instructions you could use for your “Apps Script Code Reviewer” Gem:

You are an expert Google Apps Script developer who specialises in writing clean, efficient, and secure code.

When I provide a JSON file, it will represent a complete Apps Script project. The file contains an array of file objects, each with a 'name', 'type', and 'source'.

Your task is to perform a thorough code review of the entire project. Please analyse all files together.

Specifically, focus on:

1. **Best Practices:** Check if the code follows the official Google Apps Script style guide and modern JavaScript (ES6+) conventions.  
2. **Performance:** Identify any potential bottlenecks, inefficient loops, or excessive API calls.  
3. **Security:** Look for any potential security vulnerabilities, especially concerning data handling and web app permissions.  
4. **Clarity and Readability:** Assess the code for clarity, and check for adequate comments and meaningful variable names.

Please provide your feedback in a structured format, starting with a high-level summary and then a detailed list of suggestions, grouped by file.

If you are suggesting code revisions, provide the fully revised file.

Getting Started

Here’s how to set up your own Apps Script project exporter.

Step 1: Prerequisites – Enabling the Apps Script API

The tool relies on the Apps Script API to fetch project files. To use it, you first need to link your script project to a Google Cloud Platform (GCP) project where the API is enabled.

  1. Create a GCP Project: If you don’t already have one, create a standard GCP project by visiting the Google Cloud Console.
  2. Enable the Apps Script API: Within your GCP project, navigate to the “APIs & Services” dashboard, click “+ ENABLE APIS AND SERVICES”, search for “Google Apps Script API”, and enable it.
  3. Configure the OAuth Consent Screen: Before the script can be authorised, you must configure the consent screen.
  • In the GCP Console, navigate to “APIs & Services” > “OAuth consent screen”.
  • Choose Internal for the User Type and click Create.
  • Fill in the required fields (App name, User support email, and Developer contact information) and click Save and Continue. No other configuration is needed. As this is for internal use, you do not need to submit the app for verification.
  1. Link to Your Apps Script Project:
  • Open your Apps Script project (the one containing the exporter code).
  • Go to “Project Settings” (the cog icon ⚙️).
  • Under “Google Cloud Platform (GCP) Project”, click “Change project” and enter your GCP project number.

Step 2: Setting Up the Exporter Sheet

  1. Make a Copy: Click this link to make your own copy of the pre-configured Google Sheet Template.
  2. Configure the Destination Folder:
  • In your new sheet, go to Extensions > Apps Script.
  • In the Code.gs file, find the line const DEST_FOLDER_ID = '...';
  • Replace the placeholder ID with the ID of the Google Drive folder where you want your JSON exports to be saved. You can get this from the folder’s URL (it’s the string of characters after folders/). Tip: Your copy of this template can be shared with your colleagues. Also share the folder with them so that the script can write the export file.
  1. Save and Authorise: Save the script project. Return to your sheet and reload the page. A new “Script Exporter” menu will appear. The first time you run it, you will be prompted to authorise the script’s required permissions.

Step 3: Exporting Your First Project

Using the tool is the easiest part!

  1. Find the Script ID: First, you need the ID of the project you wish to review. The easiest way to find this is by copying it from the script editor’s URL.
  • For standalone scripts: The URL will look like https://script.google.com/d/THIS_IS_THE_ID/edit. The ID is the long string of characters between /d/ and /edit.
  • For container-bound scripts (in a Sheet, Doc, etc.): From your Google Sheet or Doc, open the script editor via Extensions > Apps Script. The URL in this new browser tab will have the same format. Copy the ID from there.
  1. Run the Exporter: In your exporter sheet, click Script Exporter > Export Script Project.
  2. Paste the ID: When the dialog box appears, paste in the Script ID you just copied and click OK.
  3. Check the Output: The script will fetch the project files, create a JSON file in your designated Drive folder, and confirm with a success message. A log of the export, including a link to the file, will be automatically added to the “Execution Log” sheet.

You can now head over to the Gemini App (gemini.google.com), add the JSON file from Google Drive, and start your comprehensive code review!

I hope you find this tool as useful, it’s a small optimisation, but one that hopefully makes integrating Gemini for Workspace into our daily Apps Script development practices that much smoother. I’d love to hear if you use this or similar approaches and any other tips you have for Gemini assisted Google Workspace development. Happy scripting!

Automating Personalised Gmail Drafts with the AI Formula and Apps Script

The AI formula in Google Sheets is a powerful and easy way to use Gemini AI directly inside of your Google Sheets. In this example, we use the AI formula to generate draft emails providing feedback on student exam scores. Then we use AI to write Apps Script that moves the draft emails from our Sheet into drafts in our Gmail, ready to send.

For many, the process of drafting personalised emails from a list of contacts in Google Sheets is a tedious, manual task. It involves switching between tabs, copying and pasting data, and carefully composing each message. But what if you could automate the entire workflow, generating perfectly tailored draft emails in Gmail with the click of a button?

In a recent video tutorial, Google Developer Expert Ben Collins demonstrates a powerful and efficient method to achieve exactly this. He showcases how to combine the intelligence of the new AI() formula in Google Sheets with the automation capabilities of Google Apps Script to turn structured data into ready-to-review email drafts.

What makes this solution so compelling is that it’s more than just a clever solution; it’s a glimpse into the future of work in Google Workspace.  As Google continues to embed AI and end-to-end automations like Workspace Flows, the ability to effectively guide these systems becomes paramount. Ben’s solution provides a perfect, practical sandbox for honing a crucial new skill of prompt engineering and mastering the art of communicating with Large Language Models.

To see the full demonstration and get started on your own prompting journey, be sure to watch Ben’s complete video.

Source: Turn Sheets Data into Gmail Drafts with the AI Formula and Apps Script 

Unlocking Google’s Full API Universe and Authentication Flows in Google Apps Script

A Google Apps Script project that dynamically generates modern, feature-rich client libraries for any public Google API directly from the Google API Discovery Service.

For many developers, Google Apps Script is the go-to platform for rapidly automating and extending Google Workspace. Its simplicity and deep integration are powerful. But as projects grow in ambition, developers often encounter two significant walls: needing to connect to a Google API that isn’t built-in, or requiring an authentication flow, like a service account, that the standard services don’t support.

What if you could break through those walls? What if you could use a robust client library for almost any Google API—from Firebase to Cloud Billing—in seconds, right from Apps Script itself?

Today, I’m excited to introduce the Google API Client Library Generator for Apps Script, a project and code repository designed to solve these very challenges. It comes with a full suite of pre-built libraries, enabling you to significantly expand what’s possible on the platform.

Why This Matters: Beyond the Built-in Services

While Apps Script’s built-in and advanced services are excellent, they represent just a fraction of Google’s vast API ecosystem. This collection of generated libraries unlocks the rest, offering two critical advantages:

  1. Complete API Coverage: The generator uses the Google APIs Discovery Service to create clients for over 400 APIs. If it’s in the Google Discovery Service then there is a library for it in the repository.
  2. Flexible Authentication Flows: Generated libraries are not tied to the standard user-permission model. This means you can use service accounts for server-to-server authentication, or implement other OAuth2 flows as needed.

Getting Started

Getting started is as simple as finding the library you need in the build/ directory of the GitHub repository and copying the code into your Apps Script project. For detailed setup instructions and other authentication options, please refer to the main README.md in the repository.

Unlocking Professional Workflows with Service Accounts

The real power of this approach comes from flexible authentication. For Google Workspace developers, this also unlocks the ability to use service accounts with domain-wide delegation to make API calls on behalf of other users in your domain.

To handle the authentication flow, you’ll need an OAuth2 library. The following example uses the OAuth2 for Apps Script library, but other options are also available. Once you have your chosen library set up, you can use the following pattern:

// The email of the user to impersonate (for domain-wide delegation).
const USER_EMAIL = '[email protected]'; 

function getService_() {
  // Credentials from the service account's JSON key file.
  const serviceAccountCreds = {
    "private_key": "-----BEGIN PRIVATE KEY-----\n...",
    "client_email": "[email protected]",
  };

  // Use a unique name for the service, like 'Drive' or 'BigQuery', to avoid
  // token collisions between different services.
  return OAuth2.createService('Drive:' + USER_EMAIL)
      .setTokenUrl('https://oauth2.googleapis.com/token')
      .setPrivateKey(serviceAccountCreds.private_key)
      .setIssuer(serviceAccountCreds.client_email)
      .setSubject(USER_EMAIL)
      .setCache(CacheService.getUserCache())
      .setScope('https://www.googleapis.com/auth/drive');
}

/**
 * Lists files using the configured service account.
 */
function listFilesWithServiceAccount() {
  const service = getService_();
  if (!service.hasAccess()) {
    console.log('Service Account authentication failed: ' + service.getLastError());
    return;
  }
  
  const token = service.getAccessToken();

  // This is where the generated library is used with the custom token.
  const drive = new Drive({
    token: token 
  });

  const files = drive.files.list({
    supportsAllDrives: true,
    pageSize: 10
  });
  
  console.log('Files found via service account:', JSON.stringify(files, null, 2));
}

Under the Bonnet: The Generator

For those who want to tweak the generation logic or integrate it into their own workflows, the generator itself is included in the repository. It’s a self-contained Apps Script project that fetches API metadata and programmatically constructs modern, robust ES6 classes with features like automatic exponential backoff for handling API errors.

Join the Community and Contribute

This project was heavily inspired by the work of Spencer Easton and aims to build upon that foundation. It’s a community effort.

While libraries for all APIs are generated, not all have been extensively tested. If you use a library and find a bug, or have an idea for an improvement, please open a GitHub Issue. Pull requests are, of course, always welcome. Happy scripting!

Source: GitHub – mhawksey/Google-API-Client-Library-Generator-for-Apps-Script

An AI Assistant to Triage Your Inbox and Draft Replies with Apps Script and the Gemini API

Image credit: Zack Akil

🤖 AI-powered Gmail assistant that automatically analyzes emails and drafts responses using Google’s Gemini AI

Google is rapidly integrating Gemini across the Workspace platform, bringing powerful AI features directly into the tools we use every day. While these native integrations offer incredible value, developer-led solutions provide a tantalising glimpse into the future of hyper-personalised automation, especially as we look toward the potential of the new Google Workspace Flows. This is where the real magic begins, allowing for custom agents that can handle complex, multi-step tasks.

Google Developer Advocate Zack Akil has created one such example solution that turns your Gmail inbox into a smart, automated assistant. His open-source project, the “AI-got-this-gmail-delegator,” is a Google Apps Script that uses the Gemini API to analyse incoming emails, categorise them, and even draft replies based on your own knowledge and writing style.

This project is a great example of how to combine the power of Google Workspace automation with the intelligence of modern AI. The script works by:

  • Analysing Incoming Emails: When a new email arrives, the script sends the content to the Gemini API for analysis.
  • Providing Context: The AI’s analysis is guided by a “knowledge base” that you provide in a Google Doc. This could include your role, common responses, or specific project details.
  • Intelligent Triage: Based on the email’s content and your knowledge base, the script decides whether the email needs a reply, requires manual intervention, or can be archived.
  • Drafting Replies: For emails that need a response, the script uses Gemini to generate a draft reply in your own writing style, ready for you to review and send.

The entire process is logged in a Google Sheet, giving you a complete overview of your AI assistant’s activity.

What makes this project so compelling is its practicality and customisability. By modifying the Google Doc knowledge base and the writing style prompts, you can create a personalised email assistant that understands the nuances of your work.

To explore the code and set up your own AI email delegator, check out the project on GitHub.

Source: GitHub – ZackAkil/AI-got-this-gmail-delegator 

Extending Chat Apps Across Workspace with Universal Actions

In this video we build a Chat app as a Google Workspace add-on with Apps Script and extend it to other Workspace applications (Calendar, Gmail, Drive, Docs, Sheets, and Slides).

With the recent general availability of being able to build Google Chat apps as Google Workspace add-ons, the developer community now has a unified model for creating integrated experiences across Google Workspace.

To see this new framework in action, Pierrick Voulet from the Google Developer Relations team has released a fantastic video tutorial, ‘Build a Chat app as a Google Workspace add-on with Apps Script’.

The ‘OOO Assistant’: A Practical Demonstration

The video centres on building an ‘Out-of-Office Assistant’ that can block out the user’s Calendar for the day and set a Gmail out-of-office auto-reply. The real magic is how this Chat-based logic extends into a full Workspace Add-on, available in the sidebars of Gmail, Calendar, Drive, Docs, Sheets and Slides. This is achieved with minimal code changes, primarily by configuring the appsscript.json manifest to include:

  • homepageTrigger to display a UI card in the add-on sidebar.
  • universalActions that reuse the exact same functions (blockDayOut()setAutoReply()) originally built for the Chat quick commands.

The video provides a complete overview of the process, and you can get hands-on with the shared code yourself. For more technical details, check out the official Extend Google Chat documentation.

Source: Build a Chat app as a Google Workspace add-on with Apps Script (YouTube)
Code: Build a Google Workspace add-on extending all UIs (GitHub)
Docs: Extend Google Chat (Documentation)

A Better Way to Organise and Find Your Drive Files with Apps Script and Custom Properties

Learn how to add, update and search or query for custom Google Drive properties in file metadata in with Google Apps Script

Managing and searching for project files in Google Drive can be a challenge, especially when naming conventions are not followed. While Google’s Drive Labels API offers a solution, its use is often restricted to administrators, leaving many developers looking for a more accessible alternative.

Over on his blog, Yagisanatode, developer Scott Donald provides an in-depth tutorial on using custom file properties with Apps Script. This technique allows you to programme-matically attach your own searchable metadata—like a project ID, version number, or status—to any file in Drive.

The tutorial walks you through the entire process, including:

  • Enabling the Drive API v3 advanced service.
  • Using Drive.Files.update() to add properties to a file.
  • Crafting queries with Drive.Files.list() to find files based on your custom properties.

For developers working at scale, the tutorial also covers how to avoid slow, iterative updates. Scott introduces a powerful batch update method that uses UrlFetchApp to efficiently modify thousands of files in a single request.

This is an excellent, practical guide for any intermediate developer looking to build more organised and robust file management systems in Google Drive.

Source: Add Custom Queryable Properties to Any File in Google Drive with Apps Script – Yagisanatode

Go Beyond the Gemini App: Building Custom AI Tools with Gemini CLI and Apps Script

This article explores the integration of the Gemini Command-Line Interface (CLI) with Google Sheets using the Model Context Protocol (MCP). It demonstrates how to leverage the open-source projects MCPApp and ToolsForMCPServer to create a bridge between the Gemini CLI and Google Workspace. This enables users to perform powerful data automation tasks, such as creating, reading, and modifying tables in Google Sheets directly from the command line, using natural language prompts. The article provides practical examples and sample prompts to illustrate the seamless workflow and potential for building sophisticated, AI-powered applications within the Google Cloud ecosystem.

For developers who work in the command line, the introduction of Google’s Gemini Command-Line Interface (CLI) has opened up new ways to interact with AI. The open-source tool allows you to bring the power of Gemini models directly into your terminal, making it a useful companion for coding assistance, content generation, and task automation. While the CLI can interact with your local file system and the internet, its standard capabilities don’t provide a direct path to your personal data within Google Workspace.

But what if you could extend it? What if you could create a secure connection, allowing the Gemini CLI to interact with your own files in Drive, events in Calendar, or emails in Gmail?

Over the past month, Google Workspace Developer Expert Kanshi Tanaike has published an insightful series of blog posts that provides a practical blueprint for achieving just that. In this series, he demonstrates how to use the flexibility of Google Apps Script to create a powerful, personalised bridge between the Gemini CLI and the entire suite of Google Workspace services.

At the centre of Kanshi’s solution is a simple and effective architecture. He shows readers how to build a Model Context Protocol (MCP) server using a Google Apps Script project deployed as a Web App. This server acts as the secure intermediary between the Gemini CLI and your Google account.

The key advantage of this approach lies in its security and simplicity. By using Apps Script, the complex and critical OAuth2 authorisation is handled natively within the Google ecosystem. This means developers can create a robust tool without the overhead of managing credentials or setting up separate cloud infrastructure.

Throughout the series, Kanshi doesn’t just provide the theory; he delivers the tools to make it happen. He has developed and shared two key open-source Apps Script libraries, MCPApp and ToolsForMCPServer, which significantly simplify the process. These libraries provide a ready-to-use framework and a rich set of functions for interacting with Workspace services.

The result is a system capable of executing complex, multi-step automations from a single, natural-language prompt. The examples in his posts speak for themselves:

  • Automated Data Entry: Fetching a multi-day weather forecast and populating it directly into a Google Sheet.
  • Content Creation: Uploading a local PDF to Drive, generating a summary, creating a new Google Slides presentation from that summary, and emailing it to a colleague.
  • Interactive Tasks: Generating a custom survey in Google Forms and sending out the link via Gmail.

This extensibility is what sets the approach apart. While a standard tool like the Gemini App (gemini.google.com) provides a familiar conversational interface, it offers a fixed set of features. This CLI-based method allows developers to keep that same intuitive, conversational style of interaction but makes it completely extensible. With the CLI and a custom MCP server, developers are no longer limited—they can build bespoke tools to solve their specific challenges.

For example, a common request from Workspace users is the ability to generate an entire presentation from source material. Using this framework, a developer could easily build a custom tool to do just that, triggered by a single command.

This series is a great example of the innovation happening within the Google Workspace developer community. While this command-line approach is naturally suited for developers and power users comfortable with scripting, it offers a level of control and automation that is difficult to achieve through graphical interfaces. It provides a clear, powerful, and extensible pattern for anyone in this group looking to explore their own sophisticated AI-powered automations.

We highly recommend diving into the series to see what’s possible. You can start with the most recent post, which links back to the previous articles in the series:

Source: Next-Level Data Automation: Gemini CLI, Google Sheets, and MCP

Modernising Drive Monitoring: The Google Drive Events API is Now in Public Preview

Google Drive is now integrated with the Workspace Events API, which allows third-party developers to create subscriptions on Drive items and receive notifications via Cloud Pub/Sub when those resources change. This offers developers a more reliable, featureful way of receiving events over the current files.watch and changes.watch methods that exist today.

Good news for developers working with Google Drive! Google has just announced that the Google Drive Events API is now available in a Developer Public Preview. This is a significant update for anyone who needs to track changes to files in Google Drive, offering a more robust and feature-rich way to receive notifications.

For a long time, developers have relied on the files.watch and changes.watch methods to monitor file changes. Whilst these methods have been useful, the new Drive Events API, integrated with the Google Workspace Events API, promises a more reliable and scalable solution.

What can you do with the new API?

The new API allows you to subscribe to events on Drive items and receive notifications through Cloud Pub/Sub. In this initial public preview, the following events are supported:

  • A file has been added to a folder or shared drive.
  • A file has been moved to a folder or shared drive.
  • A file has been edited, or a new revision is uploaded.
  • A file has been trashed or restored from the trash.
  • An access proposal has been created or resolved for a file.

This opens up a whole range of possibilities for building powerful applications that react in real-time to changes in Google Drive. Imagine creating automated workflows that trigger when a new file is added to a specific folder, or a security tool that alerts you when a sensitive document is moved or trashed.

How to get started

To start using the new Google Drive Events API, you’ll need to be enrolled in the Workspace Developer Public Preview program. Once you’re in, you can find the relevant documentation and getting started guides on the Google Developers site.

A Note for Google Apps Script Developers

You can absolutely use Google Apps Script to make the API calls to create and manage your event subscriptions. However, it is important to be aware that receiving the actual notifications requires a different approach to traditional Apps Script triggers.

The Drive Events API delivers all notifications to a Cloud Pub/Sub topic. This means you will need a Google Cloud Platform (GCP) project to handle these incoming messages. It’s also important to note that, according to the documentation, the Pub/Sub topic you use for notifications must be in the same Google Cloud project that you use to create the event subscription itself.

These new capabilities hopefully unlock some more efficient ways for developers and third parties to monitor Google Drive content.

Source: Google Drive Events API now available in Developer Public Preview

It’s Official: Gemini in AppSheet is Now Generally Available for Enterprise Users


We’re very excited to announce that Gemini in AppSheet Solutions is now Generally Available (GA)! This powerful capability allows AppSheet Enterprise Plus users to integrate Google’s Gemini directly into their automation workflows.

Following our previous post announcing the public preview, we are excited to share that Gemini in AppSheet Solutions is now generally available (GA) for all AppSheet Enterprise Plus users. This update allows creators to directly integrate Google’s Gemini models into their automation workflows, making AI-powered automation more accessible than ever.

What This Means for Creators

This move to general availability solidifies the simplified AI integration within AppSheet. Instead of complex setups involving API keys and external scripts, creators can now use a native “AI Task” step within their AppSheet automations. This new task can handle jobs like extracting specific data from uploaded photos or PDFs, and categorising text directly within AppSheet.

The GA release also brings enhanced confidence in building AI-powered solutions. The in-editor task testing feature allows creators to test and refine AI prompts and configurations with sample data before deployment. This is a crucial step for ensuring reliable AI, and it allows for much quicker iteration.

For administrators, the AppSheet admin dashboard now provides visibility into Gemini usage within the organisation, and allows for control over which creators can use these new features.

Key updates since Public Preview

For creators, the GA release includes a number of improvements:

  • AI tasks now support more column types, including REF types, allowing you to use information in linked tables.
  • The quality of AI responses has been improved for certain data types.

For admins, the AppSheet admin console now shows your organisation’s credit entitlement and consumption, providing insights into how your users and applications are using Gemini.

The Power of the Underlying Model

It’s also worth noting that the underlying Gemini models are market leaders and are continuously improving. New tools on the horizon, such as ‘URL context’ and the ability to also ground results with Google Search, will hopefully filter through to AI Tasks in AppSheet enabling creators to build even more powerful solutions. These advancements will allow for the creation of sophisticated AI assistants that can use real-time information, all without the need for fine-tuned models or complex custom integrations.

Getting Started: Example Template

The announcement post includes links to the relevant documentation for creators and admins. For those looking for a practical example, the AppSheet team has provided a “Book tracking with Gemini” template. This app showcases how you can upload a picture of a book cover, and then use two different AI tasks to automatically extract book-related information and categorise it by genre. I found this to be an excellent starting point for understanding how to implement these new features in your own projects.

Source: Gemini in AppSheet now Generally Available for Enterprise users!

From Vague Vibes to Structured Data: “Vibe Scraping” with Google Apps Script and the Gemini API


Nine years ago, I wrote an article describing how to scrape data from the internet in about five minutes. It featured a Google Apps Script library that allowed you to specify what to download from a webpage by identifying the text surrounding your target information. This became one of my most-read articles, and the library itself saved me a significant amount of time.

With the advent of large language models like Gemini, this entire paradigm is shifting. Just as “vibe coding” describes a more intuitive approach to programming, I’d say we’re now entering an era of “vibe-scraping.”

Using data from the web has long been a staple. But what if you could just describe the information you want and have an AI fetch it for you?

Google Developer Expert, Ivan Kutil, introduces a modern approach he calls “vibe scraping.” In his latest post, he demonstrates a powerful method that combines Google Apps Script with the Gemini API to pull structured data from any webpage directly into a Google Sheet.

To understand the power of this technique, Ivan set out to solve an old problem. He had a Google Sheet with a list of movies, each with a URL pointing to its page on ČSFD (a popular Czech-Slovak film database). His goal was to automatically populate columns with details like genre and rating by extracting the data directly from those linked pages.

At the heart of his solution is a new, experimental Gemini API feature called the URL Context tool. As the documentation notes, this tool is surprisingly flexible: it “can then retrieve content from the URLs and use that content to inform and shape its response.”

The tool can be used in two main ways:

  1. URL Context “By Itself”: In this mode, the tool directly fetches and processes the content from the URL you provide. This is a straightforward way to analyze the live content of a single page.
  2. URL Context with Google Search Grounding: In this mode, the tool can read content from a URL and then use Google Search for a more in-depth understanding.

What makes Ivan’s script so elegant is how it combines this tool with the simplicity of Google Sheets. For each row, the script constructs a prompt for the Gemini API, asking it to analyse the content of the provided URL and find the specific information defined in the spreadsheet headers.

The result is a system where modifying your data query is as easy as renaming a column. This turns a potentially complex scraping task into a simple spreadsheet edit, allowing anyone to create powerful, custom data importers.

To get the full details and the code to build this yourself, check out Ivan’s original post.

Source: Vibe Scraping with Google Apps Script and Gemini’s URL Context ~ kutil.org