How to convert json to csv in excel
Learn step-by-step methods to convert JSON to CSV in Excel using Power Query and manual flattening, with tips for nested data, large files, and clean CSV outputs.
By the end of this guide you will be able to convert JSON to CSV in Excel using two dependable methods: Power Query for nested, large data and a manual flattening approach for simple structures. You’ll learn when to apply each path, prerequisites, and how to validate the resulting CSV for clean imports.
Why converting JSON to CSV in Excel can save time
Understanding how to convert json to csv in excel can save time in many data workflows. JSON is a flexible, hierarchical format, while CSV provides a flat, tabular structure that is easy to sort, filter, and import into databases or BI tools. Excel users often face the challenge of turning JSON data into a flat, workbook-friendly format. This guide explains when to rely on built-in tools like Power Query and when a manual flattening approach makes more sense. According to MyDataTables, the optimal workflow combines automation for repetitive tasks with careful checks to avoid data loss or misalignment. You’ll learn practical criteria for choosing a method, how to design a robust transformation, and how to validate the resulting CSV before sharing with teammates.
Understanding JSON and CSV fundamentals in Excel
JSON data is structured as objects and arrays, often nesting information several levels deep. CSV is a flat, two-dimensional representation with consistent headers across rows. Excel can ingest JSON efficiently through Power Query, which unpacks nested objects into columns. The challenge is deciding which fields become headers, how to represent nested objects, and how to handle arrays. If you document your mapping decisions early, you’ll avoid rework later. This foundation helps ensure your final CSV is clean, avoids data type drift, and remains compatible with downstream systems such as databases, BI tools, or data warehouses. This section sets the stage for practical transformation.
Prepping your data: assessing structure and choosing method
Before converting, inspect the JSON to determine its complexity and the target CSV schema. Look for nested objects, arrays, and inconsistent fields. Decide whether you want one row per top-level object or one row per nested item. If the JSON is flat or near-flat, a manual flattening approach may be faster; for deeply nested data, Power Query will reduce manual effort and errors. Plan your headers in advance and consider how you will represent missing values to avoid misaligned rows when exporting to CSV.
Method A: Power Query approach (recommended for large JSON)
Power Query provides a robust, scalable path for converting JSON to CSV, especially with nested structures. Start by loading the JSON file through Get & Transform (Power Query). The tool will parse the top-level list, then expand records and lists into columns. Use the Expand button to flatten nested fields, then set appropriate data types for each column. When done, load the result into a worksheet or the data model. This method reduces manual steps and improves repeatability for ongoing data feeds.
Step-by-step: Power Query workflow
- Open Excel and start a new workbook. 2) Go to Data > Get & Transform > From File > From JSON and select your JSON file. 3) In Power Query Editor, expand top-level records to create columns. 4) Expand nested objects and arrays using the Expand icon, choosing the fields to include. 5) Rename columns for clarity and convert data types (numbers, dates, text) as needed. 6) If your data has relational elements, load to the Data Model for efficient analysis. 7) Click Close & Load to bring the table into Excel. 8) Save as CSV and verify the output for missing values or mis-encoded characters. Tips: enable data profiling in Power Query to catch type issues early.
Method B: Manual flattening technique for simple JSON
For small, flat JSON records, a manual flattening approach can be quick. Copy or paste the JSON into a text editor to inspect fields, then create a header row in Excel and map each JSON field to a column. Use Excel’s text-to-columns or simple formulas to extract values if your JSON arrives as a single line. This method avoids the overhead of Power Query but is fragile if the schema changes or if nesting appears. Keep a mapping sheet to track how each JSON key maps to a CSV header and test with several sample records.
Handling nested objects and arrays
Nested objects require careful planning to avoid bloated columns or missing data. In Power Query, use Expand to flatten the nested fields while keeping a sane column naming scheme (Parent.Child). For arrays, you have two common approaches: (a) create a row for each array element and join with parent fields, or (b) join array elements into a string (e.g., comma-separated) if row duplication is undesirable. Your choice depends on how downstream systems will consume the CSV and whether you need relational depth or a flat summary. Document your approach in a mapping sheet.
Data hygiene checks and exporting CSV
After transformation, verify the CSV by exporting a small sample and re-importing it back into Excel or a test environment. Check for encoding issues (UTF-8 is preferred), proper handling of quotes, and consistent delimiters. Validate numeric and date fields, ensuring no unintended text conversions occurred. If exporting to a database, verify that column types align with schema expectations and that there are no unintended trailing spaces or empty strings. A small validation loop saves debugging time later.
Common pitfalls and troubleshooting
Pitfalls include losing nested structures, misnamed headers, and misinterpreted data types. When things go wrong, re-open Power Query and review the applied steps in order. Ensure you are expanding the correct fields and that array handling matches your target schema. If you encounter missing values, decide if you want placeholders, nulls, or default values. For Mac users, note that Power Query support can vary by Office version, so check your edition’s capabilities before starting.
Final checklist and best practices
Before finalizing, confirm you have documented the transformation mapping, validated a sample CSV, and kept a backup of the original JSON. Use a consistent delimiter, encoding, and header naming convention. If this is part of a data pipeline, automate the process where possible and maintain version control on both the JSON source and the transformation steps.
Tools & Materials
- Excel with Power Query (Get & Transform) enabled(Office 2016+ or Microsoft 365; Power Query is built-in in modern Excel versions)
- JSON data file(Source file to convert)
- CSV destination or workbook(Where to export the resulting data)
- Text editor(For quick JSON inspection or editing before loading)
- Reference mapping sheet(Document field-to-header mappings to avoid drift)
Steps
Estimated time: 60-90 minutes
- 1
Open JSON in Excel
Start with a new workbook and prepare to import. Confirm you have a backup of the source file. This initial step sets the stage for a clean transformation.
Tip: Back up your JSON before any transformation. - 2
Import using Power Query
Navigate to Data > Get & Transform > From File > From JSON and select the file. Power Query will parse the JSON structure for you to shape.
Tip: Choose From JSON to leverage built-in parsing. - 3
Expand top-level fields
In the Power Query Editor, use the Expand button to flatten top-level records into columns. Keep only the fields you need to minimize clutter.
Tip: Only expand necessary fields to reduce noise. - 4
Flatten nested objects
For nested objects, repeatedly use Expand and rename columns to maintain clarity. This step turns nested data into a flat schema.
Tip: Use hierarchical headers like Parent.Child for readability. - 5
Handle arrays
Decide whether to duplicate rows for array elements or to join values into a delimited string. Both approaches have tradeoffs for downstream use.
Tip: Choose a method that aligns with downstream requirements. - 6
Set data types
Convert each column to the correct data type (text, number, date). Mismatched types can cause errors on import.
Tip: Apply Type Detection or set explicitly for consistency. - 7
Load to worksheet or data model
Decide whether to load the result into a worksheet for quick inspection or into the Data Model for advanced analytics.
Tip: Data Model enhances performance for large datasets. - 8
Export as CSV and verify
Use Save As to export to CSV with UTF-8 encoding. Reopen the CSV to verify delimiters and quotes.
Tip: Test with a small sample before full export.
People Also Ask
Is Power Query required to convert JSON to CSV in Excel?
Power Query is not strictly required for tiny JSON files, but it greatly simplifies nested structures and large data. Most modern Excel versions include Power Query, making it the recommended path.
Power Query isn't strictly required for small JSONs, but it's the easiest option for nested data and larger files.
Can Excel handle large JSON files efficiently?
Excel can process moderately large JSON datasets, especially with Power Query, but very large files may require chunking or external preprocessing to avoid performance issues.
Excel can handle moderately large JSONs with Power Query; very large files may need chunking.
How do I manage nested arrays during conversion?
In Power Query, expand arrays to create new rows or columns. For a flat export, join array elements into a single string. Choose based on downstream needs.
Expand arrays in Power Query or join them into strings, depending on what your downstream systems require.
Can I automate this with a macro?
VBA macros can automate parts of the flow, but for complex JSON, Power Query scripts are usually more robust and easier to maintain.
You can automate portions with VBA, but Power Query is generally more reliable for JSON to CSV.
What if the JSON structure changes?
Update your Power Query steps or the manual mapping, and keep a changelog of the schema. A mapping sheet helps.
If the JSON changes, adjust the transformation steps and mapping accordingly.
Does this work on Excel for Mac?
Power Query availability on Mac varies by Office version. Modern Office 365 builds include Power Query features, but older versions may have limited support.
Power Query on Mac is version-dependent; newer Office 365 builds offer better support.
Watch Video
Main Points
- Plan your field mappings before transforming.
- Choose Power Query for nested or large JSON.
- Validate the CSV output with a sample check.
- Keep a backup of the original JSON.
- Document transformation steps for reproducibility.

