Back to Marketstack in Excel
SheetXAI logo
Marketstack logo
Marketstack · Excel Guide

Pull Historical OHLCV Data From Marketstack Into a Excel workbook

2026-05-14
5 min read

The Scenario

You inherited the portfolio tracking workbook from someone who left three months ago. Column A has 10 tickers. There are empty columns B through H with headers that say things like Open, High, Low, Close, Volume — all blank. Somewhere in the handoff notes it says "update this weekly from Marketstack," but there are no instructions for how.

You have a Marketstack API key. You have the workbook. The gap between those two things is the problem.

The bad version:

  • Open the Marketstack docs, find the end-of-day endpoint, construct a URL with your ticker, date range, and API key, and run it in a browser
  • Parse the JSON manually, figure out which array index is "open" versus "high," copy the values into your workbook row by row for 252 rows — then repeat for all nine remaining tickers
  • Realize on ticker 6 that the date sort is descending, not ascending, go back and flip the first five worksheets, and add another 40 minutes to the project

This is not the kind of work that fits inside a lunch break. You are supposed to be doing performance analysis, not writing data transport scripts.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Excel workbook. It reads the workbook, sees the ticker list in column A, and through its built-in Marketstack integration it can pull full OHLCV histories for every ticker and write them into the workbook — without you touching the API.

For each ticker in column A, fetch the last 252 trading days of end-of-day OHLCV data from Marketstack and write date, open, high, low, close, and volume into a new worksheet per ticker, sorted by date ascending

What You Get

  • A new worksheet for each ticker in column A — named after the ticker symbol
  • Columns in order: Date, Open, High, Low, Close, Volume — 252 rows each
  • Dates sorted ascending so the most recent row is at the bottom
  • Any ticker that returns no data gets a worksheet with a note explaining why (invalid symbol, exchange not supported, etc.)

What If the Data Is Not Quite Ready

The ticker list has both symbols and company names mixed together

Column A has a mix of ticker symbols (like AAPL) and company names (like Apple Inc) — for each row, figure out the correct Marketstack ticker symbol first, then fetch the last 252 trading days of OHLCV and write them into a new worksheet named after the resolved ticker

You only want tickers from US exchanges

For each ticker in column A, fetch the last 252 days of OHLCV data from Marketstack — but only write the worksheet if the ticker's primary exchange is a US exchange; add a note in the Summary worksheet for any ticker that is listed on a non-US exchange

The date range needs to match a specific lookback window in another column

Column A has tickers, column B has a start date for each — for each ticker, fetch OHLCV data from Marketstack starting at the date in column B through today, and write the results into a new worksheet per ticker

Full pipeline: resolve symbols, pull history, calculate annualized volatility

For each ticker in column A, confirm the symbol is valid in Marketstack, then fetch the last 252 trading days of close prices, write them into a worksheet per ticker, and add a Summary worksheet showing each ticker's annualized volatility calculated from the daily log returns

Combining the validation, the data pull, and the calculation in a single prompt means the workbook is ready for modeling rather than being three separate tasks in a queue.

Try It

Get the 7-day free trial of SheetXAI and open the Excel workbook with your ticker list in column A, then ask it to pull a full year of OHLCV history from Marketstack for every row. The Marketstack integration is included in every SheetXAI plan.

See also: refreshing a watchlist with latest prices and building dividend history tables.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more