Back to Polygon.io in Excel
SheetXAI logo
Polygon.io logo
Polygon.io · Excel Guide

Pull Historical OHLC Stock Data Into a Excel From Polygon.io

2026-05-14
5 min read

The Scenario

You took over coverage of 15 portfolio stocks three weeks ago. The previous analyst left an Excel workbook with the tickers in column A and nothing else — no price history, no correlation work, no backtesting data. Your PM wants a correlation matrix by Thursday for the portfolio optimization review.

The bad version:

  • You open the Polygon.io API documentation, find the aggregates endpoint, and start writing individual API calls for each ticker — one at a time, because you're not sure how to batch them.
  • After the first five tickers you realize the date formats coming back are Unix timestamps and every CSV needs a conversion pass before you can import it into Excel cleanly.
  • You spend Wednesday evening concatenating per-ticker CSVs, realigning date columns so they match across worksheets, and reconciling two tickers that returned different row counts because of a trading halt.

Nobody gave you this project so you could spend three days moving data around. The correlation work starts when the data is already where it needs to be.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Excel workbook. It reads the ticker list in column A, understands the range you need, and through its built-in Polygon.io integration it fetches historical OHLC data and writes it directly into per-ticker worksheets — no API calls, no timestamp conversions, no import steps.

For each ticker in column A, fetch the daily OHLC data from Polygon.io for the last 180 days and write the results into a new worksheet tab named after each ticker, with columns for date, open, high, low, close, and volume.

What You Get

  • A new worksheet for each ticker, labeled with the ticker symbol.
  • Columns: Date (formatted as YYYY-MM-DD), Open, High, Low, Close, Volume — in that order.
  • Trading days with no data (holidays, halted sessions) appear as blank rows flagged with a note so they don't silently skew your correlation calculations.
  • All worksheets share the same date range and row structure, making cross-worksheet referencing for the matrix straightforward.

What If the Data Is Not Quite Ready

The tickers in column A include both equities and ETFs in mixed case

The tickers in column A include uppercase and lowercase entries and some ETF symbols mixed with equities. Normalize all tickers to uppercase, then fetch the last 180 days of daily OHLC from Polygon.io for each one and write the data into separate worksheet tabs.

Some tickers were added mid-period and only need a shorter history

For each ticker in column A, check the "Start Date" value in column B. Fetch daily OHLC data from Polygon.io starting from that date through today and write results into a worksheet named after each ticker. If column B is blank, default to 180 days back.

The workbook has a "Type" column and I only want to pull data for tickers tagged "Equity" in column C

Fetch daily OHLC data from Polygon.io only for tickers in column A where column C says "Equity". Write the last 180 days of data into separate worksheet tabs named after each ticker.

Pull the data, calculate 30-day rolling correlation between all pairs, and write the matrix

For each ticker in column A, fetch the last 180 days of daily close prices from Polygon.io and write them into a "Prices" worksheet with one column per ticker. Then calculate the 30-day rolling correlation between all ticker pairs using the most recent 30 rows and write the correlation matrix into a new worksheet called "Correlation Matrix".

One prompt. Fetch, organize, and calculate — in the order you actually need them.

Try It

Open an Excel workbook with your portfolio tickers in column A and Get the 7-day free trial of SheetXAI. Ask it to pull six months of OHLC history from Polygon.io and structure it for correlation work across per-ticker worksheets. For options data, see the spoke on pulling options chain snapshots. For the full partner overview, see the Polygon.io hub.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more