Convert MDF to XLS
Export SQL Server or disc-image MDF data to an editable legacy Excel XLS workbook.
Make XLS files online
We can't read MDF files yet, so this conversion isn't available. If you can export your work to one of these formats - or others - we'll turn it into XLS:
How to convert mdf to xls file
- Databases
- No ratings yet.
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
- 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.
- 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.
- In SSMS, connect to the instance, right-click Databases → Attach, select the MDF, and check that the listed
.ldfand.ndfpaths 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. - 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; - 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. - 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.
- 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
.xlsxcopy 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.
| 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 |