Excel 365: Calling City Weather Forecasts Using Power Queries

Thom Hartle – March 30, 2026

This post details the Excel sample at the bottom of the post using Excel's Power Queries to pull in weather forecasts for a city. There are four steps:

  1. Determine the latitude and longitude of the city to use in the api.weather.gov for pulling the forecasts.
  2. Merge the latitude and longitude of the city to the API.
  3. Pull in the forecast.
  4. Publish the formatted table of the forecast in the spreadsheet.

The name of the city and state, separated by a comma, is entered into cell B2.

f1

Cell B2 is formatted by selecting cell B2, selecting the Data tab and format as Geography.

f2

Bing produces a card that when it is opened list details available regarding the city and includes the Latitude and the Longitude. Note: not all cities have the Latitude and the Longitude listed.

f3

Cells C2 and D2 pull in the Latitude and the Longitude:

=IFERROR(B2.Latitude,"Lat not found.")
=IFERROR(B2.Longitude,"Long not found.")

This data is merged with the API URL in cell E2:

=CONCAT("https://api.weather.gov/points/",C2,",",D2)

Three Power Queries are used.

f4

The weather_url uses the formula from cell E2 to connect via the API to the government site.

The forecast_url pulls in the forecast.

The forecast is loaded as a table in the spreadsheet.

f5

Enter the city and state separated by a comma. Then hit Refresh.

Bing does not have data on all cities. Copy and paste cells C2 and D2 to C3 and D3 to store the formulas. Then manually enter in the Latitude and Longitude from Latitude and Longitude Finder in cells C2 and D2. Then hit Refresh.

This dashboard does not connect to CQG applications for data.

Requirements: Excel 365 (locally installed, not in the Cloud) or more recent.

Downloads

Disclaimer

Trading and investment carry a high level of risk, and CQG, Inc. does not make any recommendations for buying or selling any financial instruments. We offer educational information on ways to use our sophisticated CQG trading tools, but it is up to our customers and other readers to make their own trading and investment decisions or to consult with a registered investment advisor. The opinions expressed here are solely those of the author and do not reflect the opinions of CQG, Inc. or its affiliates.