Google Sheets =IMAGE() with a Sume URL: PNG, JPEG, never SVG

=IMAGE needs a URL with a protocol and rejects SVG and drive.google.com links. Put a Sume data[0].url from a png or jpeg request in a cell and pick a mode.

4 min readSume
All posts

Put the Sume data[0].url in a cell and wrap it in =IMAGE(A2, 1). Google's IMAGE function help gives the signature IMAGE(url, [mode], [height], [width]), says the URL needs a protocol, says SVG is not supported, and says drive.google.com links are not allowed. Mode 1 fits the image in the cell, 2 stretches it, 3 keeps the original size and 4 takes a custom size.

Sume's image API lists svg among its output_format values in the docs, so do not choose it for a sheet. Ask for png or jpeg, which Sheets can draw.

Which mode should a product grid use?

Modes from Google's IMAGE function help, read 2026-10-05; use column is this post's advice.
ModeBehaviourUse it for
1Fits inside the cell, keeps the ratioThumbnail columns
2Stretches to the cellAlmost never; it distorts
3Original sizeChecking real pixels
4Custom height and widthA fixed contact-sheet size

How do I fill the column from a script?

An Apps Script function can call Sume and write the URL into the sheet, and IMAGE() does the drawing. This one reads a prompt from column A and writes the URL to column B for one row.

function sumeImage(row) {
  const sheet = SpreadsheetApp.getActiveSheet();
  const prompt = sheet.getRange(row, 1).getValue();
  const res = UrlFetchApp.fetch("https://api.sume.com/v1/images", {
    method: "post",
    contentType: "application/json",
    headers: { Authorization: "Bearer " +
      PropertiesService.getScriptProperties().getProperty("SUME_API_KEY") },
    payload: JSON.stringify({ model: "openai/gpt-image-2.5", prompt: prompt,
      quality: "low", output_format: "png" }),
    muteHttpExceptions: true,
  });
  if (res.getResponseCode() !== 200) return;
  sheet.getRange(row, 2).setValue(JSON.parse(res.getContentText()).data[0].url);
}

Store the key in Script Properties, not in a cell. A 202 leaves the cell empty on purpose in this sketch; the jobs guide explains how to poll status_url for slow requests. If a row triggers a call on edit, add a guard so one edit cannot start two paid generations.

The cell holds only the link. If the sheet is shared widely, remember that anyone who can read it can open the URL, so keep unreleased product art out of a public sheet. For a gallery, set the row height first and use mode 1, then add a second column that holds the prompt, so the picture and the text that produced it stay on one row when you sort.

If you want a lower-cost review pass, ask the sheet for 512 or 1K tiers instead of 4K: the request takes resolution values 512, 1K, 2K and 4K where a model lists them, and the catalog for each model shows which. A thumbnail cell never needs more than a 1K image, and a smaller job is also less likely to run past the 30-second wait and come back as a 202.

Sources

Related posts

More in Integrations

All Integrations posts

Written by Sume