Nodes/comfyui-google-drive-upload/Upload to Google Drive
ComfyUI Node

Upload to Google Drive

Upload ComfyUI Output to Google Drive — and Ignore Half the README

By theclueless-ai·Created 8 months ago·Updated 8 months ago· 0
Upload to Google Drive
  • image
  • status
  • file_url
folder_id
filename_prefixcomfyui_output
image_format
jpeg_quality95
add_timestamptrue
credentials_json

ComfyUI saves to your local disk, and that's fine until your "local disk" is a serverless box that gets wiped between runs. On ComfyDeploy, Runpod, or any ephemeral GPU instance, every generation vanishes when the pod dies unless you ship it somewhere else first. GoogleDriveUpload fills that gap: drop it at the end of your workflow and your PNG lands in a Google Drive folder that survives the pod, grabable from your phone. If you run purely on your own machine, it's a tidy way to push finished images to a shared folder for a client. It's a small node - one class, zero stars - but it does one job, and it doesn't call any paid API.

How it works

It's an output node, which matters more than it sounds. ComfyUI treats output nodes as always-run and works backward from them, so dropping this into a graph is enough to make the whole chain execute to feed it. It takes your IMAGE tensor, converts the first frame of the batch to a PIL image (so a batch of four only uploads image zero - don't rely on it for a full gallery), encodes it as PNG, JPEG, or WEBP, builds a filename, and pushes it to a Drive folder via the google-api-python-client using a resumable upload. It returns two strings: status ("Success: Uploaded 'x' to Google Drive", or the error) and file_url, a direct webViewLink to the file. Wire status into a Text node or just let it sit - the URL is the one you actually want in your logs.

The inputs that matter

Six required inputs, one optional, and only a few deserve your attention:

  • image - your pipeline's IMAGE output.
  • folder_id - the Drive folder to upload into. Take the long ID from the folder's URL. Bonus: the node strips URL parameters and trailing path segments for you, so you can paste a full drive.google.com/drive/folders/... link and it still works.
  • image_format - PNG, JPEG, or WEBP. JPEG converts RGBA to RGB over a white background automatically, so no surprise black boxes.
  • add_timestamp - default true, appends YYYYMMDD_HHMMSS to the filename so you don't overwrite runs.
  • filename_prefix - defaults to comfyui_output; set it to something meaningful if you're uploading many images to one folder.
  • jpeg_quality - 1–100, default 95, only applies to JPEG/WEBP.

The catch: the README is lying to you

Here's the part that will cost you an afternoon. The README and the __init__.py describe a service account flow: create a Service Account in Google Cloud, share your folder with its client_email, and paste the JSON in via GOOGLE_SERVICE_ACCOUNT_BASE64 or a service_account_json input. That is not what the shipped code does. The actual node uses OAuth 2.0 for a personal Google account and needs three things: client_id, client_secret, and refresh_token - provided either in the optional credentials_json input or as GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and GOOGLE_REFRESH_TOKEN environment variables. The code's own error message tells you to "run the get_refresh_token.py script" - which is not in the repo. So you'll generate those three values yourself from a Google Cloud OAuth desktop app (enable the Drive API, create credentials, do the one-time consent dance), which is fiddly but very doable. Trust the source, not the docs.

Install

Via ComfyUI Manager, search comfyui-google-drive-upload, or:

cd ComfyUI/custom_nodes
git clone https://github.com/theclueless-ai/comfyui-google-drive-upload
cd comfyui-google-drive-upload
pip install -r requirements.txt

Then restart ComfyUI. Dependencies are just google-auth, google-auth-oauthlib, google-api-python-client, requests, Pillow, and numpy - no model downloads, no heavy weight. The included install.py (which Manager runs) handles the Google packages if they're missing.

Troubleshooting

  • "Missing OAuth credentials" - the node's most common failure, and it's self-diagnosing: it lists which of the three (client_id / client_secret / refresh_token) is missing. Check the input field, then the env vars.
  • "Access denied" or "File not found" - the OAuth account can't see the folder. Make sure the folder_id is right and the Google account that owns those credentials has access to that Drive folder.
  • "API not enabled" - you enabled Drive API in the wrong project, or forgot entirely. Check "APIs & Services → Library" in the Cloud console.
  • Refresh tokens can expire or get revoked; if it worked yesterday and fails today, regenerate the token first.

For a tiny, unmaintained-looking pack, the code is tidy - the catch is that the docs describe a different authentication model than the node actually runs. Generate the OAuth creds, trust the source, and your outputs will be parked in Drive before your ephemeral instance dies.

Categoryimage/output

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
folder_idSTRING
filename_prefixSTRINGcomfyui_output
image_formatCOMBO3 options: PNG, JPEG, WEBP
jpeg_qualityINT951–100
add_timestampBOOLEANtrue
credentials_jsonoptSTRING

Outputs (2)

NameTypeDescription
statusSTRING
file_urlSTRING