DIF to CSV — what a forgotten export actually stores
A folder of .dif files from a system nobody maintains anymore. DIF predates the spreadsheet container: it is a text record format with a small header, and it stores bytes under a single-byte encoding rather than code points. Recovery is straightforward for the rows, and the encoding is where the honesty matters.
Cell formatting, colours, column widths and merged ranges are dropped; only stored values survive.
Processed on your device. Files aren’t sent anywhere.
What a DIF file stores
The format describes a book of records with a header naming the data and text modules, then the records themselves.
- A header declares the modules and the number of records.
- Numeric fields and text fields are stored separately.
- A field with no value is stored as an empty field.
- There is no formatting layer, so nothing visual is lost.
- There are no formulas, so nothing is left unevaluated.
Reading records as rows
Each record becomes a CSV row, in the order the file stored the fields.
| Stored in DIF | In the CSV | Note |
|---|---|---|
| Numeric field 1200 | 1200 | as stored |
| Text field Riga | Riga | as stored |
| Empty field | (empty) | column position preserved |
| Accented name | may be replaced | single-byte source |
Bytes, not code points
Legacy files store bytes under a single-byte codepage. The reader decodes the file as UTF-8, so characters that were stored in another codepage can arrive changed or replaced. Accented names are the item to check against the original export, and there is no metadata in the file that tells the converter which codepage was used.
Numbers and blank fields in the CSV output
Values are written as text, because a delimited file has no types. Blank fields stay blank inside a row so columns keep their positions, while trailing blanks at the end of a row are trimmed. The output is UTF-8 with a byte order mark and CRLF line endings.
A recovered row still needs a schema
Suppose an old export has a customer code followed by a balance. After extraction, the destination still needs to know that the first field is an identifier and the second is an amount. Column order is part of that handoff. Compare a known record and an empty field before loading the CSV; a parser accepting the file is only the first check.
Checking the recovered rows
The header claims a record count, so use it as the check.
- Convert the .dif file and download the CSV.
- Open the CSV in a text editor.
- Count the rows and compare them with the records you expected.
- Check accented text against the original export.
- Convert numeric columns to numbers before importing.