> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brandfetch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Brandfetch with Google Sheets

Google Sheets' native `IMAGE` function can load any Brandfetch CDN URL directly, so you can show live company logos in a spreadsheet without installing an add-on.

## Prerequisites

* A [Brandfetch account](https://developers.brandfetch.com/) with an active client ID

## Basic formula

Drop a hardcoded domain straight into the formula:

```
=IMAGE("https://cdn.brandfetch.io/nike.com?c=BRANDFETCH_CLIENT_ID")
```

## Reference a cell

Most sheets store the domain in a column rather than hardcoding it. Concatenate the cell reference into the URL instead:

```
=IMAGE("https://cdn.brandfetch.io/"&A2&"?c=BRANDFETCH_CLIENT_ID")
```

## Apply to an entire column

Wrap the formula in `ARRAYFORMULA` to fill logos down a column automatically as new domains are added:

```
=ARRAYFORMULA(IF(A2:A="",,IMAGE("https://cdn.brandfetch.io/"&A2:A&"?c=BRANDFETCH_CLIENT_ID")))
```

## Sizing

`IMAGE` takes an optional mode argument as its second parameter: `1` fits the image to the cell, `2` stretches it, `3` keeps its original size, and `4` lets you pass custom width/height in pixels. For predictable results regardless of cell size, size the logo itself using the [Logo API's](/logo-api/parameters) own `w`/`h` path segments and keep `IMAGE` at mode `3`:

```
=IMAGE("https://cdn.brandfetch.io/nike.com/w/128/h/128?c=BRANDFETCH_CLIENT_ID", 3)
```

## Theme and fallback

Any [Logo API parameter](/logo-api/parameters) works the same way inside the formula, for example a dark-theme icon with a lettermark fallback:

```
=IMAGE("https://cdn.brandfetch.io/nike.com/theme/dark/fallback/lettermark/icon?c=BRANDFETCH_CLIENT_ID")
```

## Access all brand data (logos, colors, company data...)

`IMAGE` can only embed images. The rest of a brand's identity, its color palette, fonts, and company info, comes from the [Brand API](/brand-api/overview), which returns JSON and needs an `Authorization` header that no spreadsheet formula can send. A small Apps Script custom function fills the gap.

You'll need a Brand API key from the [API keys page](https://developers.brandfetch.com/dashboard/keys), this is a secret key, separate from the client ID used above. Open **Extensions > Apps Script**, paste the function below, and save:

```js Code.gs theme={null}
const API_KEY = "YOUR_BRAND_API_KEY";

/**
 * Returns a brand attribute from the Brandfetch Brand API.
 *
 * @param {string} domain The company domain, e.g. "nike.com".
 * @param {string} field One of "name", "description", "accent", "font".
 * @return The requested value.
 * @customfunction
 */
function BRANDFETCH(domain, field) {
  const res = UrlFetchApp.fetch(
    "https://api.brandfetch.io/v2/brands/domain/" + domain,
    { headers: { Authorization: "Bearer " + API_KEY }, muteHttpExceptions: true }
  );
  if (res.getResponseCode() !== 200) return "";

  const brand = JSON.parse(res.getContentText());
  if (field === "name") return brand.name;
  if (field === "description") return brand.description;
  if (field === "accent") {
    const accent = brand.colors.find((c) => c.type === "accent");
    return accent ? accent.hex : "";
  }
  if (field === "font") {
    const title = brand.fonts.find((f) => f.type === "title");
    return title ? title.name : "";
  }
  return "Unknown field: " + field;
}
```

Then use it like any built-in function, next to the `IMAGE` logo column:

```
=BRANDFETCH(A2, "accent")
```

<Warning>
  Brand API keys are secret. Anyone who can edit the spreadsheet can open the script and read the key, so don't share the sheet outside your team with the key in place.
</Warning>

Custom functions re-run when the sheet recalculates (for example on reopen), and every run counts against your Brand API plan's quota. Once a column is filled, freeze it with **Edit > Paste special > Values only**.
