Py’otrMuhammad Toheed Sahar

ComfyUI Batch Factory: image generation queued from a Google Sheet

A Windows tool that reads prompts from a Google Sheet, runs them through a local ComfyUI image workflow and a face-detail pass, and writes the status of every row back to the sheet.

Client
A client running local image generation
Year
2026
Type
AI video & media

The problem

The person using ComfyUI was not a developer and was spending hours clicking through it one image at a time. They wanted to type prompts into a spreadsheet and get the images without touching the node editor.

How I built it

A Python script finds every sheet row marked Pending, sends the prompt to ComfyUI's local HTTP API as a text-to-image workflow, uploads the result into a second face-detail workflow, saves the final image to an Output folder and writes Running, Done or Error back to the sheet with the filename and a timestamp. The prompt text and a random seed are patched into named nodes of the exported workflows. Install and run are one double-click each, and a step-by-step guide covers the Google setup.

What got hard

  1. A batch of any length has to survive single failures, such as a timeout or a ComfyUI error on one prompt.

    Each row runs in its own error handler. A failure writes a short error message into that row's Status cell and the batch carries on. Changing the cell back to Pending retries it, and each image has a 10 minute limit.

  2. The Google Sheets connection needs a service account, which is hard for a non-technical user to set up.

    I wrote a numbered guide with the exact sheet and tab names, column layout, status meanings and the fixes for the common errors, and the script checks for ComfyUI and the credentials file first and says what is missing.

  3. The second stage needs the first stage's image inside ComfyUI's own input folder.

    The tool uploads the generated image to ComfyUI over its API (a multipart upload using only the standard library) and points the face-detail workflow at the uploaded file.

The result

Delivered on 6 March 2026 as a small package that turns a spreadsheet of any length into a queue of generated images with one click.