What Most People Miss About How to Add API to Excel

It's 3:12 PM. You're staring at cell D7 in Dashboard.xlsm, where last week’s sales forecast is still hardcoded from a CSV you downloaded on Tuesday. Your colleague just Slack’d you a link to the live inventory API endpoint — https://api.supplychain.acme/v2/stock?region=APAC. You open Excel. You type "data connection" into Help. Nothing useful comes up.

The Setup

You’re supporting the APAC procurement team. Their weekly report pulls stock levels for 9 SKUs across 4 warehouses — but it’s manually updated every Friday from a shared Postman collection. You’ve been asked to automate it. Here’s the raw API response (simulated as a table you’d see in Power Query preview):

sku_idwarehousein_stockreorder_levellast_updated
SKU-7721Shanghai DC142852024-03-15
SKU-8849Tokyo Hub01202024-03-15
SKU-9103Singapore Fulfillment67502024-03-15
SKU-7721Tokyo Hub203852024-03-15
SKU-8849Shanghai DC311202024-03-15
SKU-9103Tokyo Hub19502024-03-15
SKU-7721Singapore Fulfillment0852024-03-15
SKU-8849Singapore Fulfillment1121202024-03-15
SKU-9103Shanghai DC88502024-03-15

The Challenge

You need this data refreshed daily — not copied and pasted. But here’s what trips people up:

  • They assume all APIs require VBA or Power Query Advanced Editor. Not true. Excel’s native Web Data Connection handles most REST GET endpoints — no code.
  • They paste the full URL into Data > From Web, forgetting that some APIs need headers (like Authorization: Bearer xyz) — and Excel won’t prompt you.
  • They refresh and get “Data source error” — then blame the API. Usually, it’s because Excel caches the first response and ignores subsequent parameter changes (like changing ?region=EMEA later).

Also: if your IT policy blocks external connections, this won’t work — and you’ll get no warning until refresh time.

Walking Through It

Open a blank workbook. Go to Data tab > Get Data > From Other Sources > From Web. Type the full URL: https://api.supplychain.acme/v2/stock?region=APAC.

Click OK. A Navigator window opens. If the API returns JSON, Excel usually auto-detects the table. Select the top-level table (often named Table or data). Click Load.

That loads raw data starting at cell A1. But notice: the last_updated column shows as text, not date. And in_stock has leading/trailing spaces in some rows (API inconsistency). So we clean it.

Select column E (last_updated). Press Ctrl+1, choose Date > 14/03/2024, click OK. Then select column C and D — right-click > Format Cells > Number > 0 decimal places.

Now fix the whitespace. In cell C2, enter: =TRIM(C2). Drag down to C10. Do same for D2:D10. Then copy → Paste Values over C2:D10. Done.

Before cleaning (A1:E10):

sku_idwarehousein_stockreorder_levellast_updated
SKU-7721Shanghai DC 142 85 2024-03-15
SKU-8849Tokyo Hub 0 120 2024-03-15

After cleaning (A1:E10):

sku_idwarehousein_stockreorder_levellast_updated
SKU-7721Shanghai DC1428515-Mar-2024
SKU-8849Tokyo Hub012015-Mar-2024

Surprising tip: To force a full reload (bypass cache), press Alt+F5 — not F5. That triggers “Refresh All” *with cache override*. Works even if you have multiple queries.

The Result

Here’s the final cleaned, auto-refreshing dataset — ready to feed into your dashboard formulas (e.g., =SUMIFS(C2:C10,A2:A10,"SKU-7721") in cell G2). Refreshes on open, or manually via Alt+F5:

sku_idwarehousein_stockreorder_levellast_updated
SKU-7721Shanghai DC1428515-Mar-2024
SKU-8849Tokyo Hub012015-Mar-2024
SKU-9103Singapore Fulfillment675015-Mar-2024
SKU-7721Tokyo Hub2038515-Mar-2024
SKU-8849Shanghai DC3112015-Mar-2024
SKU-9103Tokyo Hub195015-Mar-2024
SKU-7721Singapore Fulfillment08515-Mar-2024
SKU-8849Singapore Fulfillment11212015-Mar-2024
SKU-9103Shanghai DC885015-Mar-2024

What Could Go Wrong

Here are three things I saw break it last week — all in production files:

  • API returns HTML instead of JSON: Some endpoints (especially internal ones) serve login pages when auth fails. Excel shows “The specified file could not be found.” Solution: Test the URL in Edge first — if you see a login screen, you need headers or cookies. Excel doesn’t support either natively.
  • Column name changes silently: The API added warehouse_code last Tuesday. Excel kept loading old schema — so new column appeared as Column1 in row 1, breaking all VLOOKUPs. Fix: Right-click query > Properties > uncheck Enable load, then edit > Advanced Editor > manually update column names.
  • Auto-refresh fails on startup: User double-clicked the file — Excel opened in Protected View. Data connections are blocked by default. They saw blank cells and assumed the API was down. Fix: File > Options > Trust Center > Trust Center Settings > External Content > Enable all data connections (only if your org allows it).

Next step: Open your target workbook. Go to Data > Queries & Connections (Alt+A+Q). Right-click your query > Edit. In the formula bar, change the URL’s region=APAC to region=EMEA. Press Enter. Then hit Alt+F5.

Anna Kim

Anna Kim

Anna specializes in tax forms