Generate thumbnails and a visual asset catalog
Build a browsable gallery Sheet of Northwind's Drive assets with thumbnail previews.
Published Aug 9, 2025
Northwind keeps hundreds of images in Drive — shoot exports, logo variants, stock crops — and Drive’s grid view is fine until someone asks “do we have a landscape version of that header?”. Then it is a lot of clicking, because Drive only shows you a name and a small icon, not a real preview you can scan.
This script turns a Drive folder into a browsable catalog in a Sheet. Each image becomes a row with a live thumbnail rendered straight in the cell, plus its name, a link, and its size. The result is a gallery anyone can open, scroll, and search — no Drive permissions juggling, no downloading files to look at them.
What you’ll need
- A Drive folder of images — the folder ID goes in the config below.
- A blank Google Sheet to hold the catalog — its ID goes in the config too.
- Nothing else. The thumbnails use Drive’s own preview URL through the
IMAGE()formula, so there is no image hosting to set up.
The script
// The Drive folder whose images you want catalogued.
const ASSET_FOLDER_ID = '1abcAssetFolderId';
// The blank Sheet that will hold the catalog.
const CATALOG_SHEET_ID = '1abcCatalogId';
// Thumbnail width in pixels. Drive scales the preview to this width.
const THUMB_WIDTH = 200;
// Row height in pixels — tall enough to show the thumbnail comfortably.
const ROW_HEIGHT = 80;
/**
* Scans the asset folder for images and rebuilds a catalog Sheet with
* an in-cell thumbnail, name, link, and size for each one.
*/
function buildAssetCatalog() {
// 1. Walk every file in the folder, keeping only images.
const files = DriveApp.getFolderById(ASSET_FOLDER_ID).getFiles();
const rows = [];
while (files.hasNext()) {
const f = files.next();
if (!f.getMimeType().startsWith('image/')) continue;
// 2. Build one row: name, a live thumbnail formula, a link, the size.
// IMAGE() pulls Drive's own preview, so nothing is re-hosted.
rows.push([
f.getName(),
`=IMAGE("https://drive.google.com/thumbnail?id=${f.getId()}&sz=w${THUMB_WIDTH}")`,
f.getUrl(),
f.getSize(),
]);
}
// 3. Bail out before touching the Sheet if the folder held no images.
if (!rows.length) {
Logger.log('No images found in the asset folder — nothing to catalogue.');
return;
}
// 4. Rebuild the catalog from scratch so it always reflects the folder.
const sheet = SpreadsheetApp.openById(CATALOG_SHEET_ID).getSheets()[0];
sheet.clear();
sheet.getRange(1, 1, 1, 4).setValues([['Name', 'Thumb', 'Link', 'Size']]);
// 5. Write all rows in one call, then give them room for the thumbnails.
sheet.getRange(2, 1, rows.length, 4).setValues(rows);
sheet.setRowHeights(2, rows.length, ROW_HEIGHT);
Logger.log('Catalogued ' + rows.length + ' images.');
}
How it works
buildAssetCatalogopens the asset folder and iterates every file, skipping anything whose MIME type does not start withimage/— so PDFs and stray documents never end up in the gallery.- For each image it builds a four-cell row. The second cell is an
IMAGE()formula pointing at Drive’sthumbnailendpoint, which renders a live preview inside the cell when the Sheet recalculates. - If the folder turned up no images, it logs a message and stops before clearing the Sheet — so a misconfigured folder ID never wipes the catalog.
- It clears the first sheet and writes a fresh header row, rebuilding the catalog completely on every run.
- It writes every row in a single
setValuescall, then sets the row heights so each thumbnail has space to display instead of being clipped.
Example run
Say the asset folder holds three images. After a run, the catalog Sheet looks
like this — the Thumb column shows an actual preview, not the formula text:
| Name | Thumb | Link | Size |
|---|---|---|---|
| header-landscape.jpg | (rendered preview) | https://drive.google.com/file/d/… | 482143 |
| logo-mark-white.png | (rendered preview) | https://drive.google.com/file/d/… | 18204 |
| product-shot-03.jpg | (rendered preview) | https://drive.google.com/file/d/… | 1294870 |
Now anyone can scroll the Sheet, eyeball the previews, and click straight through to the file in Drive — no downloading required.
Run it
This is an on-demand job — run it whenever the folder’s contents have changed:
- In the Apps Script editor, select
buildAssetCatalogand click Run. - Approve the authorisation prompt the first time.
- Open the catalog Sheet — give it a moment for the
IMAGE()formulas to render their previews.
If the folder changes often, add a daily time-driven trigger so the catalog stays current without anyone remembering to refresh it.
Watch out for
IMAGE()only renders previews for files anyone with the link can view. If a thumbnail cell shows an error, open that file’s sharing settings in Drive.- The catalog covers one folder, not its subfolders. If your assets are nested, the script needs a recursive walk like the one in Flag oversized media eating your quota.
- Size is reported in raw bytes. Divide by
1024 * 1024in a spare column if you would rather read megabytes. - Drive’s thumbnail endpoint is rate-limited. A folder of several thousand images may render previews slowly the first time the Sheet opens — they cache after that.
- The script rebuilds the Sheet every run, so any manual notes you add to the catalog will be wiped. Keep notes on a second tab the script never touches.
Related
Build a recurring file-delivery system
Drop a fresh report file into a Northwind client folder weekly — they don't even ask.
Updated Dec 15, 2025
Build a Drive search index in Sheets
Make Northwind's file metadata searchable in a Sheet — like Spotlight for Drive.
Updated Dec 7, 2025
Build a shared-folder onboarding kit
Auto-grant new Northwind hires the folders they need on day one.
Updated Nov 29, 2025
Route saved email attachments to project folders
File Gmail attachments into the right Northwind client folder based on subject keywords.
Updated Nov 25, 2025
Bundle a folder of images into one PDF
Combine Northwind scans into a single deliverable PDF using a generation service.
Updated Nov 17, 2025