Convert MDF to CSV
Convert SQL Server or ASAM MDF data to usable CSV with local tools and format-specific steps.
Make CSV 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 CSV:
How to convert mdf to csv file
- Databases
- No ratings yet.
A program may require tabular text instead of an MDF database or measurement log, or the data may need spreadsheet editing, sharing, or archival in a smaller format. The correct procedure depends on whether the file belongs to Microsoft SQL Server or the ASAM measurement-data standard.
What the MDF format is
MDF is an ambiguous extension used by two unrelated formats.
- SQL Server MDF: the primary data file of a Microsoft SQL Server database, normally used with an
.ldftransaction-log file. It contains tables, indexes, schemas, and other database objects and is used by database servers, development systems, and applications that install a local SQL Server database. - ASAM MDF/MF4: a binary measurement-data format used by automotive, industrial, and test systems. Tools such as Vector CANape and CANalyzer, ETAS INCA, and dSPACE applications can create it. It stores channels, timestamps, metadata, and often large numeric signal series.
Renaming .mdf to .csv does not convert the file. A compatible application must read the MDF structure and export selected data.
What the CSV format is
CSV is plain text organized as records and fields, usually with commas separating fields and line breaks separating records. Microsoft Excel, LibreOffice Calc, Python, R, database import tools, and most reporting systems can read it.
CSV is easy to inspect, exchange, and process, but it does not preserve SQL Server indexes, relationships, permissions, or database schema. It also cannot fully preserve measurement-channel metadata, units, channel groups, or the binary structure of an MDF file. An export normally represents selected database rows or selected measurement channels, not the complete source file.
How to convert SQL Server MDF to CSV
- Install a compatible SQL Server instance, or use the instance that owns the database. Attach a copy of the MDF when possible; do not edit the file as ordinary text.
- In SQL Server Management Studio, connect to the server, right-click Databases → Attach, select the MDF file, and verify the location of its associated
.ldffile. The database must be compatible with the installed SQL Server version and accessible to the SQL Server service account. - Identify the table, view, or query to export. For example, run
SELECT * FROM dbo.Measurements;to inspect a table. Use explicit columns, joins, filters, and anORDER BYclause when the receiving system requires a defined structure or order. - For a one-time export, display the query results in SSMS and choose Save Results As, then select a CSV or delimited-text file type. For a controlled table or query export, use Database → Tasks → Export Data, select SQL Server as the source, and select a flat-file destination.
For repeatable command-line exports, use bcp:
bcp "SELECT * FROM MyDb.dbo.Measurements" queryout measurements.csv -S localhost -T -c -t,
Replace the server, database, object, authentication, encoding, and delimiter options for the installation. Use SQL authentication options instead of -T when Windows integrated authentication is unavailable. Test the output with quoted text fields and embedded commas or line breaks.
How to convert ASAM MDF or MF4 to CSV
The measurement application that created the file is usually the safest desktop option because it understands channel groups, timestamps, units, and MDF version details. In Vector, ETAS, dSPACE, or similar software, open the file, choose its measurement-data export command such as File → Export, select the required channels and time range, choose CSV, and configure the delimiter, decimal separator, timestamp format, and headers.
For a local, scriptable option, install the open-source Python asammdf package:
python -m pip install asammdf
Export the file with:
from asammdf import MDF
mdf = MDF("input.mf4")
mdf.export("output.csv", fmt="csv")
Use the package’s channel-selection and group-selection methods when only part of a large log is required. Exporting every channel can produce a very large file, and channels with different sampling rates may require resampling or produce missing values in some rows. The asammdf package also provides a graphical application for opening files and exporting selected data without writing a full script.
Online conversion is appropriate only for non-confidential, moderate-size files and only when the service explicitly lists the correct MDF variant. Services such as CloudConvert or Zamzar may support common document and data formats, but their current format lists should be checked because generic online converters often do not support SQL Server MDF or ASAM MDF/MF4. Do not upload proprietary database files or vehicle and test logs unless the provider documents encryption, retention, and deletion policies.
Quality and compatibility limitations
- SQL Server export is schema-dependent. A database may require multiple CSV files for related tables; exporting one table does not preserve foreign keys, indexes, triggers, views, or permissions.
- CSV has no universal encoding, delimiter, date format, or type system. Prefer UTF-8, quote fields containing delimiters or line breaks, and confirm whether the recipient expects commas, semicolons, or tabs.
- Spreadsheet software can change long integers, dates, scientific notation, and leading zeros. Inspect the file in a text editor or import it with explicit column types.
- Measurement data may contain irregular sampling rates, missing values, duplicate channel names, and separate channel groups. Preserve timestamps, units, and channel names in headers or a separate metadata file when the recipient needs them.
- Keep the original MDF as the authoritative source. CSV export is generally lossy and cannot recreate the original database structure or all measurement metadata.
MDF vs CSV: format comparison
How the MDF and CSV formats compare on the properties that matter most for this conversion.
| Property | .MDF Media Descriptor File | .CSV Comma-Separated Values |
|---|---|---|
| Open standard | No | Yes |
| Compression | Both | Uncompressed |
| Typical file size | Large | Small |
| Opens in a web browser | No | Yes, natively |
| Further editing | Not directly editable | Easy |
| Metadata support | Basic | Basic |
| Plain-text readable | No | Yes |
| Best used for | Long-term archiving | Data exchange |
| Introduced | 2000 | — |
| Developer | Alcohol Soft | — |
| MIME type | — | text/csv |