Power Query Problems

Extract CPT and ICD Codes from JSON with Excel Power Query

Aamir Naveed AkramAamir Naveed Akram Dec 2, 2026 869 views

Question details

Extract CPT and ICD code fields from JSON stored in a spreadsheet column and load them into a structured Excel table.

Extract CPT and ICD Codes from JSON with Excel Power Query
Product
Microsoft Excel Power Query
Device & OS
not provided
Scenario
A spreadsheet has JSON-formatted information in a Data column that needs to be transformed into separate code columns.
Observed behavior
The desired output is an Excel table with CPT and ICD fields extracted from the JSON.
Before you start

Check that the Data column contains valid JSON and identify where the CPT and ICD fields appear in a sample record. If the source range is not already an Excel table, select it and choose Insert > Table.

Solution 1Recommended

Parse and Expand the JSON Column in Power Query

Use Power Query to turn the JSON in each Data cell into records and lists, then extract the code fields.

The fields and number of expansion steps depend on the JSON structure. Expanding multiple lists can create additional rows, so check how CPT and ICD values relate to one another.

1
Open the table in Power Query

Select a cell in the source table, then choose Data > From Table/Range to open Power Query Editor.

2
Parse the JSON

Select the Data column, then choose Transform > Parse > JSON. The cells should display values such as Record or List when parsing succeeds.

3
Expand records and lists

Use the expand icon in the Data column header to select record fields. For a list, use its column header menu to expand it to new rows, then continue expanding nested records or lists until the CPT and ICD fields are visible.

4
Arrange the output

Rename the extracted columns by double-clicking their headers, drag them into the desired order, and remove unneeded columns. Set code columns to Text using the data type icon in each column header.

5
Load the result

Choose Home > Close & Load to return the transformed data to Excel, then check the resulting rows and codes against the source JSON.

Parse and Expand the JSON Column in Power Query
Check list relationships: If CPT and ICD codes are in separate lists, expanding both may produce combinations rather than one-to-one matches. Inspect the JSON structure before deciding how to expand them.
Free Microsoft Office alternative

Review Extracted Code Tables in WPS Spreadsheets

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for Excel formats. Open an exported workbook to review and edit its code table as you move between office suites; WPS does not fix or replace Excel Power Query.

Review and edit structured CPT and ICD code tablesOpen and save Microsoft Excel XLSX filesWork in a familiar spreadsheet interfaceUse a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Where can I find the JSON parsing command in Power Query?

In Power Query Editor, select the column containing JSON text and choose Transform > Parse > JSON.

Why do I see Record or List instead of the codes?

Those values represent nested JSON structures. Use the expand icon or column header menu to expand them until the CPT and ICD fields appear.

How do I keep code values as text?

After expanding the code fields, select each code column and use its data type icon to choose Text. If a leading zero was not stored in the original JSON value, changing the type cannot recover it.

Why did expanding the JSON create extra rows?

Expanding a list to new rows creates a row for each list item. Expanding separate lists can create combinations, so inspect the source JSON to determine how the codes should be paired.

How can I update the output after the source data changes?

After updating the source table, use Data > Refresh All in Excel to rerun the query and update the loaded results.