For faster navigation, this Iframe is preloading the Wikiwand page for Data Interchange Format.

Data Interchange Format

This article may be too technical for most readers to understand. Please help improve it to make it understandable to non-experts, without removing the technical details. (September 2010) (Learn how and when to remove this message)

Data Interchange Format (.dif) is a text file format used to import/export single spreadsheets between spreadsheet programs.

Applications that still support the DIF format are Collabora Online, Excel,[note 1] Gnumeric, and 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, FileMaker, Framework, Lotus 1-2-3, Multiplan, OpenOffice.org Calc and StarCalc.[1][2]

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.[3]

History

[edit]

DIF was developed by Software Arts, Inc. (the developers of the VisiCalc program) in the early 1980s. The specification was included in many copies of VisiCalc, and published in Byte Magazine. Bob Frankston developed the format, with input from others, including Mitch Kapor, who helped so that it could work with his VisiPlot program. (Kapor later went on to found Lotus and make 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

[edit]

DIF stores everything in an 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 and Gnumeric, offer more 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

[edit]

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:

  • −1 – directive type, the second number is ignored, the following line is one of these keywords:
    • BOT – beginning of tuple (start of row)
    • EOD – end of data
  • 0 – numeric type, value is the second number, the following line is one of these keywords:
    • V – valid
    • NA – not available
    • ERROR – error
    • TRUE – true boolean value
    • FALSE – false boolean value
  • 1 – string type, the second number is ignored, the following line is the string in double quotes

Header chunk

[edit]

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

[edit]

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

[edit]

For example, assume we have two columns with one column header row and two data rows:

Text Number
hello 1
has a double quote " in text −3

In a .dif file, this would be (→ indicates comments):

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

See also

[edit]

Notes

[edit]
  1. ^ Microsoft Excel's implementation caused interoperability problems, see § Discrepancies in implementations.

References

[edit]
  1. ^ "LibreOffice Calc – Supported File Formats". LibreOfficeHelp.com. 2020-10-06. Archived from the original on 2016-12-13. Retrieved 2020-09-08.
  2. ^ "File formats that are supported in Excel". support.microsoft.com. Archived from the original on 2020-11-11. Retrieved 2021-09-08.
  3. ^ Petrosky, Mary (August 5, 1985). "File Conversion Market Grows". InfoWorld. Vol. 7, no. 31. pp. 36–37. "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."

Sources

[edit]
[edit]
{{bottomLinkPreText}} {{bottomLinkText}}
Data Interchange Format
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?