Site icon Best Excel Tutorial

How to Export Power Query Results to Different Formats

Power Query transforms raw data into clean, organized datasets, but your work isn’t complete until you export the results to a format that serves your business needs. Whether you need to share data with colleagues, integrate with other systems, or archive information, this comprehensive guide covers all export methods and formats available.

From traditional Excel and CSV to modern formats like Parquet and direct SQL integration, you’ll learn practical techniques for every scenario and platform.

Table of Contents

Toggle

Why Export Power Query Results?

Exporting Power Query data is essential for several critical business functions:

1. Export Power Query to Excel (.XLSX)

Method A: Close and Load to Excel

The most straightforward method for Excel users:

  1. Open your Excel workbook and access the Data tab
  2. Select Get Data and configure your Power Query source
  3. Apply all necessary transformations in the Power Query Editor
  4. Click Close & Load button to load results directly into an Excel sheet
  5. The data appears in a new or existing worksheet
  6. Save your file using File > Save (automatically .xlsx format)

Method B: Copy Table to Excel

For Power BI Desktop users exporting to Excel:

  1. In Power BI Desktop, go to Model View or Data View tab
  2. Right-click the table you want to export
  3. Select Copy Table from the context menu
  4. Open Excel and click on the cell where you want to paste
  5. Use Ctrl + V to paste the data
  6. Format as needed and save as .xlsx

Method C: Analyze in Excel Feature

For Power BI reports with live connections:

  1. Open your Power BI report in the service or desktop
  2. Click the Export button in the ribbon
  3. Select Analyze in Excel
  4. An Excel file downloads with an active connection to your Power BI dataset
  5. When opened, Excel automatically pulls the latest data from Power BI
  6. This enables dynamic analysis without manual refreshes

Advantages of Excel Export:

2. Export Power Query to CSV Format

Method A: Save As CSV from Excel

Convert loaded Power Query results to CSV:

  1. Load your Power Query data using Close & Load
  2. Select the entire data range (or just the data portion)
  3. Go to File > Save As
  4. In the file type dropdown, choose CSV (Comma delimited) (.csv)
  5. Enter your filename and click Save
  6. Excel may warn about losing formatting—click Yes to continue

Method B: Export from Power BI Visuals

Export Power BI report data directly to CSV:

  1. In your Power BI report, locate the visual you want to export
  2. Click the three dots (…) menu in the top-right corner of the visual
  3. Select Export data
  4. Choose between two options:
    • Summarized data – exports only visible values in the current visual
    • Underlying data – exports complete dataset behind the visual
  5. Power BI downloads a .csv file automatically

Method C: Handling Large Datasets with VBA

For datasets exceeding Excel’s row limits (1,048,576 rows):

Option Explicit
Public FSO As New FileSystemObject

Public Sub ExportLargeToCsv()
    Dim wbTarget As Workbook
    Dim rs As Object
    Dim cmd As New ADODB.Command
    Dim filePath As String
    
    filePath = "C:\ExportedData\results.csv"
    
    With Application
        .ScreenUpdating = False
        .DisplayAlerts = False
    End With
    
    Set wbTarget = ActiveWorkbook
    On Error GoTo ErrHandler
    
    ' Initialize model connection
    wbTarget.Model.Initialize
    Set cmd.ActiveConnection = wbTarget.Model.DataModelConnection.ModelConnection.ADOConnection
    cmd.CommandTimeout = 0
    cmd.CommandText = "EVALUATE YourQueryName"
    
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open cmd
    
    ' Write to CSV
    Call WriteRecordsetToCSV(rs, filePath, True)
    rs.Close
    Set rs = Nothing
    
    MsgBox "Export completed to " & filePath
    
ExitPoint:
    With Application
        .ScreenUpdating = True
        .DisplayAlerts = True
    End With
    Exit Sub
    
ErrHandler:
    MsgBox "Error: " & Err.Description
    Resume ExitPoint
End Sub

CSV Export Best Practices:

3. Export Power Query to JSON Format

Method A: Parse JSON in Power Query

Working with JSON data sources:

  1. In Power Query Editor, click Get Data > From Other Sources > JSON
  2. Paste or browse to your JSON data source
  3. Power Query automatically parses the structure
  4. Expand nested elements to transform into columns
  5. Click Close & Load to complete

Method B: Create JSON Output with Custom M Code

Generate JSON format from your Power Query results:

let
    Source = YourSourceQuery,
    ConvertToJSON = Text.FromBinary(Json.FromValue(Table.ToRows(Source)))
in
    ConvertToJSON

Method C: Export Table Rows as JSON Array

For creating API-ready JSON:

let
    Source = YourTable,
    ToRecords = Table.ToRows(Source),
    ToJSON = Json.FromValue(ToRecords)
in
    ToJSON

JSON Export Use Cases:

4. Export Power Query to XML Format

Method A: Parse XML in Power Query

Working with XML source data:

  1. In Power Query, select Get Data > From Other Sources > XML
  2. Browse or paste your XML content
  3. Power Query parses the hierarchical structure
  4. Select the element level you want to convert to a table
  5. Expand nested nodes to create columns

Method B: Generate XML Output

Create XML-formatted output from tabular data:

  1. Use Power Query’s text functions to wrap columns in XML tags
  2. Example: <row><Name>" & [Name] & "</Name></row>
  3. Concatenate all rows with a root element wrapper
  4. Export the result as a text or XML file

XML Export Benefits:

5. Export Power Query to Parquet Format

Method A: Using Power BI Export Query Results (2025)

The newest direct export method:

  1. Open Power BI Desktop with your Power Query ready
  2. Go to File > Options and settings > Options
  3. Under Global > Preview Features, enable Export Queries from Power Query
  4. Restart Power BI Desktop
  5. In Power Query Editor, click Export Query Results in the ribbon
  6. Select your destination (Fabric Dataflow Gen2, Lakehouse, OneLake)
  7. Configure credentials and click Export
  8. Data exports as compressed Parquet files automatically

Method B: Convert CSV to Parquet Using DuckDB

For command-line Parquet conversion:

COPY (SELECT * FROM 'C:\data\file.csv') 
TO 'C:\data\file.parquet' 
(FORMAT PARQUET, COMPRESSION SNAPPY);

Method C: Using Python Pandas

For advanced users with Python installed:

import pandas as pd

# Read data
df = pd.read_csv('data.csv')

# Export to Parquet
df.to_parquet('data.parquet', compression='snappy', index=False)

Parquet Export Advantages:

6. Export Power Query to SQL Database

Method A: Direct SQL Insert with M Code

Push Power Query results directly to SQL Server:

let
    Source = YourTransformedQuery,
    InsertValues = Text.Combine(
        List.Transform(
            Table.ToRows(Source), 
            each "(" & Text.Combine(List.Transform(_, Text.From), ",") & ")"
        ), 
        ","
    ),
    SQL = "INSERT INTO TargetTable VALUES " & InsertValues
in
    Sql.Database("ServerName", "DatabaseName", [Query = SQL])

Method B: Using Execute SQL Statement

Execute stored procedures or dynamic SQL:

  1. In Power Query Editor, create your transformed data
  2. Add a custom step with SQL connection details
  3. Use Sql.Database() function to connect
  4. Execute INSERT, UPDATE, or MERGE statements
  5. Handle errors with try-catch logic

Method C: Load to SQL Using Power BI Dataflows

  1. Create a Power BI Dataflow with your Power Query
  2. Configure the Link tables option to SQL storage
  3. Dataflow automatically maintains SQL tables
  4. Refresh the dataflow to update SQL data

SQL Export Use Cases:

7. Export Power Query Using Copy & Paste

Quick Clipboard Method:

  1. In Power Query Editor, right-click the final transformation step
  2. Select Copy Table from the context menu
  3. Open your destination application (Excel, Word, Google Sheets)
  4. Click where you want to paste
  5. Use Ctrl + V (or Cmd + V on Mac)
  6. Data pastes with formatting preserved

Tab-Separated Values Format:

8. Export Format Comparison and Selection Guide

Format File Size Best For Complexity
Excel (.xlsx) Large General analysis, sharing Easy
CSV (.csv) Very Small Data portability, legacy systems Very Easy
JSON (.json) Small Web APIs, mobile apps Moderate
XML (.xml) Small Enterprise systems Moderate
Parquet (.parquet) Very Small Big data, analytics Complex
SQL Database N/A Operational systems Complex

9. Best Practices for Power Query Exports

Performance Optimization

Data Integrity

Security and Compliance

10. Troubleshooting Export Issues

Problem: “Query exceeds row limitations”

Solution: Excel has a 1,048,576 row limit. For larger datasets:

Problem: “Data types change after export”

Solution:

Problem: “Export feature not visible in Power BI”

Solution:

Problem: “Permission denied exporting to SQL”

Solution:

11. Advanced Export Scenarios

Scenario 1: Automated Daily Export Pipeline

Create a Power Automate flow for recurring exports:

  1. Trigger: Recurrence (daily at 2 AM)
  2. Action: Refresh Power BI dataset
  3. Action: Export to SharePoint as Excel file
  4. Action: Archive previous day’s file
  5. Action: Send email notification with download link

Scenario 2: Real-Time Export to Data Warehouse

Continuous data synchronization:

  1. Use incremental refresh in Power Query
  2. Export changed rows to SQL every 30 minutes
  3. Merge with existing data using MERGE statement
  4. Monitor refresh logs for failures

Scenario 3: Multi-Format Export Distribution

Export to multiple formats for different audiences:

The Bottom Line

Power Query export capabilities enable seamless data integration across your entire technology ecosystem. Select export formats based on your specific requirements:

Start with simple methods like Close & Load or Copy Table. As your needs grow, explore advanced options like Parquet export and direct database integration. Always prioritize data quality and security, and automate recurring exports using Power Automate for consistency and reliability.

Exit mobile version