# Data Interchange Format

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Data_Interchange_Format
> Markdown URL: https://mediated.wiki/source/Data_Interchange_Format.md
> Source: https://en.wikipedia.org/wiki/Data_Interchange_Format
> Source revision: 1355431694
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Spreadsheet file format}}
{{Distinguish|LDAP Data Interchange Format}}
{{Redirect|.dif|the video file format|DV (video format)#Application software support}}
{{this|a data exchange format for spreadsheets|the general concept|Data exchange}}

'''Data Interchange Format''' (.dif) is an obsolete<ref>{{Cite web |last=Chen |first=Raymond |date=2020-02-26 |title=What's up with the CF_SYLK and CF_DIF clipboard formats? |url=https://devblogs.microsoft.com/oldnewthing/20200226-00/?p=103489 |access-date=2026-05-21 |website=The Old New Thing |language=en-US}}</ref> [text file](/source/text_file) [format](/source/file_format) used to import/export single [spreadsheet](/source/spreadsheet)s between spreadsheet programs.

Applications that still support the DIF format are [Collabora Online](/source/Collabora_Online), [Excel](/source/Microsoft_Excel),<ref group=note>[Microsoft Excel's](/source/Microsoft_Excel) implementation caused interoperability problems, see §&nbsp;Discrepancies in implementations. </ref> [Gnumeric](/source/Gnumeric), and [LibreOffice Calc](/source/LibreOffice_Calc). Historical applications that used to support it until they became end of life or no longer acknowledge support of the format are [dBase](/source/dBase), [FileMaker](/source/FileMaker), [Framework](/source/Framework_(office_suite)), [Lotus 1-2-3](/source/Lotus_1-2-3), [Multiplan](/source/Multiplan), [OpenOffice.org Calc](/source/OpenOffice.org_Calc) and [StarCalc](/source/StarCalc).<ref>{{Cite web|date=2020-10-06|title=LibreOffice Calc – Supported File Formats|url=https://www.libreofficehelp.com/libreoffice-calc-supported-file-formats/|url-status=live|access-date=2020-09-08|website=LibreOfficeHelp.com|archive-url=https://web.archive.org/web/20161213065746/http://libreofficehelp.com/libreoffice-calc-supported-file-formats/ |archive-date=2016-12-13 }}</ref><ref>{{Cite web|title=File formats that are supported in Excel|url=https://support.microsoft.com/en-us/office/file-formats-that-are-supported-in-excel-0943ff2c-6014-4e8d-aaea-b83d51d46247|url-status=live|access-date=2021-09-08|website=support.microsoft.com|archive-url=https://web.archive.org/web/20201111210012/https://support.microsoft.com/en-us/office/file-formats-that-are-supported-in-excel-0943ff2c-6014-4e8d-aaea-b83d51d46247 |archive-date=2020-11-11 }}</ref>

A limitation with DIF format is that it cannot handle multiple spreadsheets in a single workbook. Due to the similarity in abbreviation and in age (both date to the early 1980s), the DIF spreadsheet format it is often confused with '''Navy DIF'''; Navy DIF, however, is an unrelated "document interchange format" for word processors.<ref name="InfoWorld 1985">{{Cite magazine | last = Petrosky | first = Mary | title = File Conversion Market Grows |magazine= [InfoWorld](/source/InfoWorld) | volume = 7 | issue = 31 | pages = 36–37 | date = August 5, 1985 | url = https://books.google.com/books?id=AC8EAAAAMBAJ }} "Among the file formats designed to facilitate the interchange of text files between microcomputers running different word processing software, IBM's Document Content Architecture (DCA) and the U.S. Navy's document interchange format (DIF) seem to have the greatest support."</ref>

==History==
DIF was developed by Software Arts, Inc. (the developers of the [VisiCalc](/source/VisiCalc) program) in the early 1980s. The specification was included in many copies of VisiCalc, and published in [Byte Magazine](/source/Byte_Magazine). [Bob Frankston](/source/Bob_Frankston) developed the format, with input from others, including [Mitch Kapor](/source/Mitch_Kapor), who helped so that it could work with his VisiPlot program. (Kapor later went on to found [Lotus](/source/Lotus_Development) and make [Lotus 1-2-3](/source/Lotus_1-2-3) happen.) The specification was copyright 1981.

DIF was a registered trademark of Software Arts Products Corp. (a legal name for Software Arts at the time).

==Syntax==
DIF stores everything in an [ASCII](/source/ASCII) text file to mitigate many cross-platform issues back in the days of its creation. However modern spreadsheet software, e.g. [OpenOffice.org Calc](/source/OpenOffice.org_Calc) and [Gnumeric](/source/Gnumeric), offer more [character encoding](/source/character_encoding) to export/import. The file is divided into 2 sections: header and data. Everything in DIF is represented by a 2- or 3-line chunk. Headers get a 3-line chunk; data, 2. Header chunks start with a text identifier that is all caps, only alphabetic characters, and less than 32 letters. The following line must be a pair of numbers, and the third line must be a quoted string. On the other hand, data chunks start with a number pair and the next line is a quoted string or a keyword.

===Values===
A value occupies two lines, the first a pair of numbers and the second either a string or a keyword.
The first number of the pair indicates type:
*&minus;1 &ndash; directive type, the second number is ignored, the following line is one of these keywords:
**BOT &ndash; beginning of tuple (start of row)
**EOD &ndash; end of data
*0 &ndash; numeric type, value is the second number, the following line is one of these keywords:
**V &ndash; valid
**NA &ndash; not available
**ERROR &ndash; error
**TRUE &ndash; true boolean value
**FALSE &ndash; false boolean value
*1 &ndash; string type, the second number is ignored, the following line is the string in double quotes

===Header chunk===
A header chunk is composed of an identifier line followed by the two lines of a value.
*TABLE - a numeric value follows of the version, the disused second line of the value contains a generator comment
*VECTORS - the number of columns follows as a numeric value
*TUPLES - the number of rows follows as a numeric value
*DATA - after a dummy 0 numeric value, the data for the table follow, each row preceded by a BOT value, the entire table terminated by an EOD value

The numeric values in header chunks use just an empty string instead of the validity keywords.

==Discrepancies in implementations==
Some implementations (notably those of older Microsoft products) swapped the meaning of VECTORS and TUPLES. Some implementations are insensitive to errors in the dimensions of the table as written in the header and simply use the layout in the DATA section.

==Example==
For example, assume we have two columns with one column header row and two data rows:
{| class="wikitable" frame="box" rules="all"
! Text
! Number
|-
| hello
| 1
|-
| has a double quote " in text
| &minus;3
|}

In a .dif file, this would be (→ indicates comments):
<pre>
TABLE
0,1
"EXCEL"
VECTORS     → the number of columns follows as a numeric value
0,2         → '0' indicates that it's a numeric type, '2' since we have 2 columns
""
TUPLES      → the number of rows follows as a numeric value
0,3         → '0' indicates that it's a numeric type, '3' since we have 3 rows
""
DATA        → after a dummy 0 numeric value, the data for the table follow
0,0         → this is the dummy 0 numeric value
""
-1,0        → '-1' for the directive type. This is followed by either a 'BOT' or an 'EOD'
BOT         → signifies the start of a row
1,0         → '1' since the cell contains a string. (The second number is ignored)
"Text"      → this is the String that's in the cell
1,0         → '1' since the cell contains a string.
"Number" 
-1,0  
BOT         → another row 
1,0         → a string follows
"hello"
0,1         → numeric value ('0') of value '1'
V           → 'V' is for 'Valid'
-1,0 
BOT         → another row
1,0
"has a double quote "" in text"
0,-3
V
-1,0 
EOD         → End of Data
</pre>

== See also ==

* [Data exchange](/source/Data_exchange)
* [Comma-separated values](/source/Comma-separated_values) (CSV format)

==Notes==
{{reflist|group=note}}

==References==
{{Reflist}}

==Sources==
* Jeff Walden: File Formats for Popular PC Software. John Wiley & Sons, Inc., 1986. {{ISBN|0-471-83671-0}}
* [Comment](/source/Talk%3AData_Interchange_Format) from [Dan Bricklin](/source/Dan_Bricklin), one of the developers of [VisiCalc](/source/VisiCalc), on the [discussion page](/source/Talk%3AData_Interchange_Format) of this article
* Commodore 64 Data Files, A BASIC Tutorial. (1984). David Miller. {{ISBN|0835907910}}. Pages 212-231.

==External links==
* [http://www.atarimagazines.com/compute/issue25/105_3_NEW_PRODUCTS_SOFTWARE_ARTS_ESTABLISHES_DATA_INTERCHANGE_FORMAT.php Announcement of DIF Clearinghouse] by Software Arts Products Corp.

Category:Spreadsheet file formats
Category:Data serialization formats

---
Adapted from the Wikipedia article [Data Interchange Format](https://en.wikipedia.org/wiki/Data_Interchange_Format) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Data_Interchange_Format?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
