Skip to content

Convert MDF to XLS

Export SQL Server or disc-image MDF data to an editable legacy Excel XLS workbook.

Convert MDF files online

We don’t have a dedicated online converter for MDF to XLS yet, but you can convert MDF files online to these formats:

Want to convert MDF to XLS?

Let us know. We pick the conversions to add next by how many people ask for them.

How to convert mdf to xls file

A recipient may require an older Excel workbook, or a report may need editing and sharing without SQL Server access. The correct export depends on whether the .mdf file is a SQL Server database or an optical-disc image.

What the MDF format is

In Microsoft SQL Server, .mdf is the primary database data file. It stores tables, indexes, views, and other database objects, usually alongside an .ldf transaction-log file and sometimes one or more .ndf secondary data files. MDF files are commonly found in SQL Server installations, application-data folders, and copied database directories.

Some disc-imaging applications also use .mdf for a CD or DVD image, often with an accompanying .mds descriptor. This type of MDF contains disc sectors and files, not relational tables, so it cannot be directly exported as a spreadsheet.

What the XLS format is

.xls is the Microsoft Excel 97–2003 binary workbook format. It remains useful when the recipient uses older Excel or software that cannot open .xlsx. It supports normal spreadsheet operations, including formulas, filtering, formatting, and charts.

Each XLS worksheet is limited to 65,536 rows and 256 columns. Choose .xlsx instead when the receiving application supports it or the result may exceed those limits.

Export a SQL Server MDF file

  1. Make a working copy of the MDF and its associated log and secondary data files. Never attach or modify the only copy of a production database.
  2. Install or access a SQL Server instance that can read the database. SQL Server Management Studio (SSMS) alone does not open MDF files; it connects to the SQL Server Database Engine. SQL Server Express can be suitable for smaller, non-production databases.
  3. In SSMS, connect to the instance, right-click Databases → Attach, select the MDF, and check that the listed .ldf and .ndf paths are correct before attaching it. An MDF copied without its log may require log reconstruction or database repair, which should not be attempted on the original file.
  4. Inspect the database and identify the required tables, views, columns, and rows. A query can filter or combine data, for example: SELECT CustomerID, Name, OrderDate, Total FROM dbo.Orders;
  5. Right-click the database and select Tasks → Export Data to open the SQL Server Import and Export Wizard. Set SQL Server as the source and Microsoft Excel 97-2003 as the destination, then provide a filename ending in .xls.
  6. Choose Copy data from one or more tables or views for a direct table export, or Write a query to specify the data to transfer for filtered or joined results. Review mappings, worksheet names, null handling, and destination data types before running the export.
  7. Open the workbook in Excel or LibreOffice Calc and check dates, decimal separators, null values, long text, leading zeroes, and row counts. Save an additional .xlsx copy when the legacy format is not required.

The SSMS Import and Export Wizard is preferable to a generic file converter because it reads SQL Server tables and data types. If the Excel destination is unavailable, install the Microsoft Access Database Engine provider with the same 32-bit or 64-bit architecture as the wizard, then restart the wizard.

For repeatable exports, write a selected query to CSV with SQL Server's bcp utility, open the CSV in Excel, and select File → Save As → Excel 97-2003 Workbook (*.xls). For example:

bcp "SELECT CustomerID, Name, OrderDate, Total FROM MyDb.dbo.Orders" queryout "C:\exports\orders.csv" -S localhost -T -c

-T uses Windows authentication. Use -U for SQL Server authentication and avoid placing a password in a command that may be saved in shell history.

Handle an optical-disc MDF file

Use a disc-image utility to mount the image, or open and extract it with an archive utility. WinCDEmu and AnyBurn can mount common disc images; 7-Zip can extract files when it recognizes the image but does not mount a virtual disc.

If the mounted image contains CSV, XML, or another tabular file, open it in Excel or LibreOffice Calc and select File → Save As with .xls as the output type. If it contains PDFs, audio, application files, or installation media, there is no meaningful automatic spreadsheet conversion.

Online conversion options and privacy

Online services generally cannot interpret a SQL Server MDF as a relational database. Export the required table to CSV locally first, then use a service such as CloudConvert or Zamzar for CSV-to-XLS conversion only when the data is non-sensitive and the service currently offers that output format. Configure the CSV delimiter and character encoding correctly, and inspect the resulting workbook.

Do not upload MDF files containing customer records, financial information, credentials, or proprietary application data to a generic converter. A local SQL Server export followed by Excel or LibreOffice avoids transmitting the database and preserves more control over types and formatting.

Quality and compatibility limits

SQL Server types do not always map cleanly to legacy Excel. datetime2 and datetimeoffset may lose precision or be exported as text, very large integers may be rounded, binary columns are not suitable for ordinary cells, and identifiers such as ZIP codes can lose leading zeroes unless exported as text. Test formulas and date interpretation after export.

Split large results across worksheets or files before reaching the XLS row and column limits. Columns containing more than 32,767 characters also exceed the maximum text length of an Excel cell.

MDF vs XLS: format comparison

How the MDF and XLS formats compare on the properties that matter most for this conversion.

Comparison of the MDF and XLS file formats
Property .MDF Media Descriptor File .XLS Microsoft Excel Spreadsheet
Open standard No No
Compression Both Both
Typical file size Large Medium
Opens in a web browser No Partial
Further editing Not directly editable Limited
Metadata support Basic Basic
Plain-text readable No No
Best used for Long-term archiving Data exchange
Introduced 2000 1987
Developer Alcohol Soft Microsoft
MIME type — application/vnd.ms-excel

Information about file extensions and file types is provided by File-Extensions.org

Frequently asked questions

Will my MDF database tables stay intact when converted to XLS?

The table data can be exported into worksheet cells, but database relationships, indexes, constraints, queries, stored procedures, and other database structure are not preserved in XLS. The result is an editable spreadsheet rather than a working database.

Can I convert an MDF disc image directly to XLS?

No, not unless the disc image contains readable tabular data that can first be extracted. An MDF disc image is a container for stored files or media, while XLS can hold spreadsheet data but cannot represent the image itself.

Will all my MDF data fit in an XLS worksheet?

Not necessarily, because legacy XLS has limits on worksheet rows and columns and may require large tables to be split or truncated. Data types that have no direct spreadsheet equivalent may also be converted to text or simplified values.

Why are dates, numbers, or special characters wrong after MDF to XLS conversion?

This usually happens when database types, null values, regional date settings, or text encoding are mapped differently to spreadsheet cells. Reviewing column types and regional settings before export helps prevent values from being interpreted as dates, numbers, or garbled text.

Already downloaded

This file has already been downloaded. For your privacy it was deleted from our server right after the download, so it cannot be downloaded again. To get it once more, convert the file again.