What Most People Miss About Exporting SQL to Excel

Yes, you can export SQL to Excel. But if you copy-paste query results directly from SSMS or MySQL Workbench into Excel, you’ll lose leading zeros, mangle dates like '2024-03-15' into serial numbers, and silently truncate VARCHAR(2000) fields at 255 characters.

The Setup

You’re pulling customer order data from a production database for a finance review. The query returns 9 columns: CustomerID, FullName, Email, OrderDate, ShipDate, TotalAmount, Status, Region, and Notes. The Notes field contains free-text comments up to 1,800 characters — things like "Urgent: client requested expedited shipping after 2024-03-10" or "PO# ACME-7721 attached via portal." Here’s what the raw result looks like in SQL Server Management Studio (SSMS):
CustomerIDFullNameEmailOrderDateTotalAmountNotes
C-8842Sarah Chens.chen@acmecorp.com2024-03-15$45,200.00Final approval received. PO# ACME-7721 confirmed.
C-9107James Riveraj.rivera@nexlogix.io2024-03-16$12,850.50Client requested change to shipping address after 2024-03-10. Updated in system.
C-7731Amina Patelamina.patel@veridion.co2024-03-17$89,100.00Urgent: client requested expedited shipping. Confirmed via call on 2024-03-14.
C-8295Derek Wongdwong@stratoview.net2024-03-18$3,240.75Invoice #SV-2024-03-8295-A sent. Client confirmed receipt.
C-9014Tasha Johnsontasha.j@bluemountain.org2024-03-19$55,600.00PO# BM-2024-Q3-0914 attached. Approved by finance on 2024-03-15.
C-7652Rafael Diazrdiaz@quantumedge.ai2024-03-20$17,333.20Follow-up needed: client hasn’t signed SOW as of 2024-03-18.
C-8441Priya Mehtap.mehta@solara.tech2024-03-21$62,100.00Approved for 90-day net terms per exec override on 2024-03-16.
C-9338Kenji Tanakak.tanaka@kyoto-solutions.jp2024-03-22$28,450.00Japanese-language contract uploaded. Internal review complete.

The Challenge

You need this data in Excel — not just for viewing, but for sorting by OrderDate, filtering by Region, and building a PivotTable with TotalAmount. But here’s the trap: if you highlight all rows in SSMS and paste into Excel (Ctrl+V), Excel auto-detects the first few rows and sets column formats before seeing the full dataset. It converts '2024-03-15' to 45366 (the Excel serial number), drops the leading zero in 'C-8842' if you sort later, and cuts off Notes after character 255 — even though the field contains 142 characters in row 1 and 178 in row 3. Worse: if your query includes a calculated field like CAST(GETDATE() AS DATE), Excel pastes it as a static value *and* strips the time zone-awareness from DATETIMEOFFSET fields.

Walking Through It

Do this — not Ctrl+C/Ctrl+V. Step 1: In SSMS, run your query. Then click Results > Save Results As…. Choose CSV (Comma delimited) (*.csv). Save as "orders_q1_2024.csv". Step 2: Open Excel. Go to Data tab > Get Data > From Text/CSV. Navigate to your CSV file and click Import. Step 3: In the preview window, click Transform Data. In Power Query Editor, select the OrderDate column. Right-click > Change Type > Date. Do the same for TotalAmount → Decimal Number. For Notes, right-click > Change Type > Text. Step 4: Select CustomerID. Right-click > Change Type > Text. This prevents Excel from converting 'C-8842' to a number or dropping the dash. Step 5: Click Close & Load. Excel loads the data into a new worksheet starting at A1. Before (what happens with Ctrl+V):
A1B1C1D1E1F1
C-8842Sarah Chens.chen@acmecorp.com4536645200Final approval received. PO# ACME-7721 confir
After (Power Query import):
A1B1C1D1E1F1
C-8842Sarah Chens.chen@acmecorp.com2024-03-1545200.00Final approval received. PO# ACME-7721 confirmed.
Counterintuitive tip: Never use "Paste Special > Text". It still triggers Excel’s auto-formatting engine. CSV + Power Query is the only reliable path.

The Result

Your final Excel sheet starts at A1 with clean, typed data. OrderDate is a true Date (not text or serial), so you can sort chronologically and build timelines. CustomerID stays as text — no accidental math or zero-truncation. Notes shows full content. And because Power Query loaded it as a Table (Ctrl+T), you get structured references like Orders[TotalAmount] for formulas.
A1B1C1D1E1F1
C-8842Sarah Chens.chen@acmecorp.com2024-03-15$45,200.00Final approval received. PO# ACME-7721 confirmed.
C-9107James Riveraj.rivera@nexlogix.io2024-03-16$12,850.50Client requested change to shipping address after 2024-03-10. Updated in system.
C-7731Amina Patelamina.patel@veridion.co2024-03-17$89,100.00Urgent: client requested expedited shipping. Confirmed via call on 2024-03-14.
C-8295Derek Wongdwong@stratoview.net2024-03-18$3,240.75Invoice #SV-2024-03-8295-A sent. Client confirmed receipt.
C-9014Tasha Johnsontasha.j@bluemountain.org2024-03-19$55,600.00PO# BM-2024-Q3-0914 attached. Approved by finance on 2024-03-15.

What Could Go Wrong

Mistake #1: Using “Copy with Headers” from SSMS and pasting into a blank workbook. Excel treats the first row as labels and applies AutoFit — which resizes column widths *before* loading full text. Notes gets cut at ~120 chars. Fix: Always use CSV + Power Query. Mistake #2: Opening the CSV directly by double-clicking it. Windows opens it in Excel using the default text import wizard — which guesses types based on first 8 rows only. If your first 8 OrderDate values are all in 2024, it may fail on '2023-12-01' later. Fix: Import via Data > From Text/CSV, never double-click. Mistake #3: Forgetting to set CustomerID to Text *before* loading. Excel sees 'C-001' and 'C-002' and converts them to 'C-1', 'C-2'. You’ll notice it when sorting — C-10 appears before C-2. Fix: In Power Query, select CustomerID column > Transform tab > Data Type > Text. Here’s your action checklist:
StepActionKeyboard Shortcut
1Save SSMS results as CSVAlt+F+A
2In Excel: Data > From Text/CSVAlt+A+T
3In Power Query: Select column > Transform > Data Type > [correct type]Alt+D+T
4Click Close & LoadAlt+F+C
David Park

David Park

David brings deep expertise in office supply evaluation and procurement. He has tested hundreds of products to help teams make informed purchasing decisions.