Working with Large Datasets from SQL Server in Excel: Performance Tips
How to handle millions of rows when connecting Excel to SQL Server without crashing or waiting forever.
Excel has a row limit of about 1 million rows. But even well below that limit, performance degrades with large datasets from SQL Server. Here's how to work efficiently with big data.
Filter at the Database, Not Excel
The most important rule: don't pull more data than you need.
Instead of importing all records and filtering in Excel, add WHERE clauses to your query:
SELECT * FROM Orders WHERE OrderDate >= '2025-01-01'
Database filtering is orders of magnitude faster than transferring and filtering in Excel.
Select Only Needed Columns
SELECT * pulls every column, including large text fields you might not need.
Specify exactly what you need:
SELECT OrderID, CustomerName, Total FROM Orders
Use Power Query's Query Folding
Power Query tries to push transformations back to the database (query folding). This means filtering and aggregations happen server-side.
To check if a step folds: right-click a step in Power Query → View Native Query. If visible, that step runs on the database.
Some operations break folding (like adding custom columns). Order your steps to keep folded operations first.
Load to Data Model Instead of Worksheet
Excel's Data Model (Power Pivot) handles large datasets better than worksheets:
When loading a query: choose “Only Create Connection” and check “Add to Data Model”
Data stays compressed in memory. Use PivotTables to analyze without putting every row on a sheet.
Aggregate Before Import
If you only need summaries, aggregate in the SQL query:
SELECT Region, SUM(Sales) as TotalSales FROM Orders GROUP BY Region
This returns 5 rows instead of 500,000.
Import SQL Data Directly into Excel Cells
Skip the copy-paste workflow. XLNavigator SQL Import lets you run queries and place results exactly where you need them.
Related Reading
- Power Query vs Direct SQL — choose the right approach
- Database Reports — build maintainable reports
- Connection Methods — all ways to connect
Official Resources
- Create PivotTables — analyze large datasets
- Power Query overview — data transformation tool
Want more Excel tips like this?
Get our free guide: 10 Excel Shortcuts Microsoft Doesn't Tell You About
Join 3,000+ Excel users boosting their productivity.