Back to EODHD APIs in Excel
SheetXAI logo
EODHD APIs logo
EODHD APIs · Excel Guide

Pull Live Quotes Into an Excel workbook and Calculate Unrealized P&L

2026-05-14
5 min read

The Scenario

Your portfolio tracking workbook has 25 rows — ticker, shares held, average cost basis. The numbers have sat there for three weeks. Today someone from the investment committee sent a message asking for an updated P&L summary by end of day. Current prices aren't in the workbook. Calculating unrealized gains without them means either opening each position in a browser tab and typing the price by hand, or pulling a delayed quote feed you don't trust.

The bad version:

  • Open a financial data site, look up the current price for position one, type it into column D, move to position two.
  • Do that 25 times, aware that by the time you reach position 25, position 1's price is already stale.
  • Build a formula column manually for unrealized gain/loss — (D2-B2)*C2 — then copy it down and discover that two rows had their cost basis entered as a text string, not a number, so the formula silently returns zero.

You submit the summary and spend the next hour wondering whether the numbers are right.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Excel workbook. It reads the portfolio table, fetches live quotes from EODHD for every ticker simultaneously, writes the prices into column D, and calculates unrealized P&L in column E — in one pass.

Pull live quotes for all 25 tickers in my Excel portfolio table using EODHD and add a 'Current Price' column and a 'Unrealized Gain/Loss' column next to each position.

What You Get

  • Column D populated with the latest EODHD quote for each ticker
  • Column E populated with calculated unrealized P&L
  • Any position where the price returned null flagged in column F with a note
  • Numbers formatted consistently — no mixed text/number types

What If the Data Is Not Quite Ready

The cost basis column has mixed currency entries

Some positions were entered in USD, others in GBP from a UK account.

For each ticker in column A of my Excel portfolio workbook, fetch the current price from EODHD in the ticker's native currency. Where column B (cost basis) is flagged in column C as GBP, convert the current price to GBP using today's EODHD FX rate before calculating P&L in column E.

The portfolio workbook has multiple account worksheets

Positions are split across three worksheets — 'Retirement', 'Taxable', and 'Crypto'.

Fetch live quotes from EODHD for every ticker in column A of my 'Retirement', 'Taxable', and 'Crypto' worksheets, write the current price into column D of each, and then build a 'Summary' worksheet with total unrealized P&L by account and overall.

Some tickers are ETFs with delayed pricing

A few rows hold ETF tickers that EODHD returns with a 15-minute delay.

Pull current prices from EODHD for all tickers in column A of my Excel portfolio workbook, write them to column D, and mark column F as 'Real-time' or '15-min delay' based on the EODHD data type returned.

Full committee prep: price update + percentage moves + sector breakdown

Fetch live quotes from EODHD for every position in my Excel portfolio workbook, calculate unrealized P&L in column E, add a column F for today's percentage price change, look up each ticker's sector from EODHD fundamentals, write the sector into column G, and build a 'Sector Summary' worksheet showing total P&L by sector.

One prompt handles the fetch, the calculations, the enrichment, and the summary.

Try It

Get the 7-day free trial of SheetXAI and open your Excel portfolio workbook, then ask it to pull live prices from EODHD and compute the P&L column. You can also see how to pull historical OHLCV data for backtesting or browse all EODHD use cases at the integration overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more