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

Pull Treasury Yield Curve and Macro Data Into a Google Sheet

2026-05-15
5 min read

The Scenario

You're a fixed-income analyst and you've been asked to build a yield curve chart for a presentation to the investment committee next week. The ask is simple on the surface: current U.S. Treasury yields across all standard maturities (1-month through 30-year), plus historical data for the last two years so the committee can see how the curve has shifted. The data is in Polygon. The problem is getting it into Excel in the shape you need.

Wait — you're using Excel workbooks. The problem is getting it into Excel workbooks in the shape you need.

The bad version:

  • Open Polygon, find the Treasury yield endpoint.
  • Discover that yields for different maturities are separate API calls, not a single endpoint that returns all maturities at once.
  • Write eight separate calls (1M, 3M, 6M, 1Y, 2Y, 5Y, 10Y, 30Y), pull two years of history for each one.
  • Pivot the data so dates are rows and maturities are columns, which means manually combining eight time series with potentially mismatched dates.

It's Tuesday. The presentation is Friday. You did not budget three days for yield curve data collection.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent inside your Excel workbook that reads Polygon's macro and Treasury data endpoints and handles the multi-series pivot for you.

Fetch historical U.S. Treasury yields from Polygon for all standard maturities (1M, 3M, 6M, 1Y, 2Y, 5Y, 10Y, 30Y) for the last 2 years and write them into a Yield Curve sheet with dates as rows and maturities as columns.

What You Get

  • A Yield Curve sheet with dates in column A (YYYY-MM-DD) and one column per maturity: 1M, 3M, 6M, 1Y, 2Y, 5Y, 10Y, 30Y.
  • All eight time series aligned by date — no mismatched rows from weekends or holidays.
  • Two years of daily closing yields, ready to chart directly.
  • Any dates with partial data (one or more maturities missing) noted with a flag in a rightmost column.

What If the Data Is Not Quite Ready

I also need CPI and PCE alongside the yield data

Pull the CPI and PCE inflation data from Polygon for the last 10 years and import it into my sheet with date, CPI value, and PCE value as columns in a Macro Indicators sheet.

I want just the most recent yield snapshot, not the full two-year history

Fetch the current U.S. Treasury yield for all standard maturities from Polygon and write the yield values into a Yield Snapshot sheet with maturity labels in column A and current yield in column B.

I need to calculate the 2Y-10Y spread over time as a recession indicator

Pull daily 2-year and 10-year Treasury yields from Polygon for the last 5 years, calculate the 2Y-10Y spread for each date, and write date, 2Y yield, 10Y yield, and spread into a Yield Spread sheet — flag any date where the spread is negative in column E.

Fetch full yield curve history, calculate the curve slope change month-over-month, and highlight steepening vs. flattening months

Fetch monthly U.S. Treasury yields for all 8 maturities from Polygon for the last 3 years, calculate the 2Y-10Y spread for each month, calculate the month-over-month change in spread, and highlight months with steepening (spread increasing) in green and flattening in red.

One prompt builds the historical dataset, the spread calculations, and the visual flags together.

Try It

Get the 7-day free trial of SheetXAI and open any Excel workbook you use for macro or fixed-income analysis, then ask it to pull Treasury yield history from Polygon across all maturities. You might also want to pull cash flow data for portfolio companies to compare against the macro backdrop.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more