What do you get?
A Google Sheet with one card per row and a Flipzi → Refresh prices menu. Running it fills in the current price, the market it came from and when it was observed, for every row, using the bulk endpoint of the Flipzi Data API. A second function finds the id of a card from its name and number, so the sheet can be filled without leaving it.
You need a Google account and a Data API key. Create a free developer account to get one.
1. Lay out the sheet
Row 1 holds headers; data starts in row 2. The script reads column A and writes columns B to D. Everything from column E on is yours.
| A | B | C | D | E onward |
|---|---|---|---|---|
| Card id | Price (EUR) | Market | Observed | Name, quantity, what you paid… |
2. Store the key outside the cells
Open Extensions → Apps Script, then Project Settings → Script Properties, and add a property named FLIPZI_KEY with your key as the value. The script reads it from there. Do not paste the key into a cell or into the code.
3. The script
Replace the contents of Code.gs with this, save, and reload the sheet. The menu appears after the reload.
const API = 'https://data.flipzi.io';
const BATCH = 25; // ids per request: your plan's bulk cap
const CURRENCY = 'eur'; // or 'usd'
function onOpen() {
SpreadsheetApp.getUi().createMenu('Flipzi')
.addItem('Refresh prices', 'refreshPrices')
.addToUi();
}
function flipziKey_() {
const key = PropertiesService.getScriptProperties().getProperty('FLIPZI_KEY');
if (!key) throw new Error('Add FLIPZI_KEY under Project Settings > Script Properties.');
return key;
}
function refreshPrices() {
const sheet = SpreadsheetApp.getActiveSheet();
const lastRow = sheet.getLastRow();
if (lastRow < 2) return;
const ids = sheet.getRange(2, 1, lastRow - 1, 1).getValues()
.map(row => String(row[0]).trim().toLowerCase());
const found = {};
const wanted = ids.filter(Boolean);
for (let i = 0; i < wanted.length; i += BATCH) {
const res = UrlFetchApp.fetch(API + '/v1/cards/bulk', {
method: 'post',
contentType: 'application/json',
headers: { 'X-API-Key': flipziKey_() },
payload: JSON.stringify({ card_ids: wanted.slice(i, i + BATCH), currency: CURRENCY, grade: 'RAW' }),
muteHttpExceptions: true,
});
if (res.getResponseCode() !== 200) {
throw new Error('Flipzi answered ' + res.getResponseCode() + ': ' + res.getContentText());
}
JSON.parse(res.getContentText()).data.forEach(row => {
found[String(row.requested_id || row.card_id).toLowerCase()] = row.prices[0] || null;
});
}
const out = ids.map(id => {
const p = found[id];
if (!id) return ['', '', ''];
if (p === undefined) return ['unknown id', '', ''];
if (p === null) return ['no price', '', ''];
return [p.price_cents / 100, p.market, p.updated_at];
});
sheet.getRange(2, 2, out.length, 3).setValues(out);
}
The first run asks for permission to edit the sheet and to call an external service. Three outcomes are written per row: a price, no price for a card the API knows but cannot price today, and unknown id for a value in column A that is not a card id. A missing price is never written as 0, so a SUM over column B stays honest.
4. Find card ids without leaving the sheet
Add this function to the same file. It returns up to five matches as rows of id, name, set and number.
/**
* Finds cards. Example: =FLIPZI_FIND("charizard ex", "pokemon", "125")
* @customfunction
*/
function FLIPZI_FIND(name, game, number) {
const params = ['q=' + encodeURIComponent(name), 'page_size=5',
'game=' + encodeURIComponent(game || 'pokemon')];
if (number) params.push('number=' + encodeURIComponent(number));
const res = UrlFetchApp.fetch(API + '/v1/cards/search?' + params.join('&'), {
headers: { 'X-API-Key': flipziKey_() },
muteHttpExceptions: true,
});
if (res.getResponseCode() !== 200) return 'Flipzi answered ' + res.getResponseCode();
const cards = JSON.parse(res.getContentText()).data;
if (!cards.length) return 'No match';
return cards.map(c => [c.id, c.name, c.set.name, c.number]);
}
Type the formula in a scratch area, pick the right row, and paste its id as a value into column A. Then delete the formula: left in place it calls the API again whenever the sheet recalculates. Check set and number before you copy an id; the first match for a name is not always the card you own, and special printings are separate cards (printings and finishes).
If your list already has TCGplayer product ids, Cardmarket product ids or pokemontcg.io ids, GET /v1/cards/lookup converts them, and the bulk call accepts pokemontcg.io ids such as sv3-125 directly in column A.
5. Refresh on a schedule
In the Apps Script editor open Triggers, add a trigger for refreshPrices, choose Time-driven and a daily timer. Once a day is enough for a collection sheet. To keep a history, add a line at the end of refreshPrices that appends today's date and the column total to a second tab; the API returns per-card history (price history guide), but the value of your collection over time is yours to record.
Quota and limits
- Units: the bulk call costs one unit per card, so a refresh costs as many units as the sheet has cards. A 200-card sheet refreshed daily is about 6,000 units a month.
- Batch size: set
BATCHto your plan's cap: 25 (Basic), 100 (Pro), 500 (Ultra), 750 (Mega); the free plan allows 25. A larger batch is refused with422 BULK_LIMIT_EXCEEDED. - Refused, not half done: a batch that would exceed the remaining allowance returns
429before anything is priced, and errors cost no units. - Graded cards: change
gradeto a code such asPSA_10, or add a grade column and group by it. Graded prices need Pro or above. - Use: the free plan is for development and evaluation. A sheet that runs a shop, a buylist or a client report needs a paid plan, which includes commercial use. See caching, storage and licensing.
Build the sheet on a free key
The free plan reaches the bulk call and search, so the whole sheet can be built and tested before you pick a plan.
Get a free API key Try it in the playground Compare API plans