DIF (.dif)


    DIF spreadsheet format.
    Standard file format for spreadsheets and other tabular data.
    Used as an exchange format for spreadsheet applications.
    DIF is an acronym for Data Interchange Format.
    Plain text format.
    Stores a single spreadsheet.
    Developed in 1980 as part of the VisiCalc spreadsheet software.

Import and Export

  • Import["file.dif"] imports a DIF file, returning a list of lists.
  • Export["file.dif",expr] exports a two-dimensional array to a DIF file.
  • Import["file.dif"] returns a two-dimensional array of strings and numbers, representing the rows and columns stored in the file.
  • Export["file.dif",expr] creates a DIF file from an array expr, using the InputForm of non-numeric table elements.
  • Import["file.dif",elem] imports the specified element from a DIF file.
  • Import["file.dif",{elem,suba,subb,}] imports a subelement.
  • Import["file.dif",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","DIF"] or Import["file",{"DIF",elem,}].
  • Export["file.dif",expr, elem] creates a DIF file by treating expr as specifying element elem.
  • Export["file.dif",{expr1,expr2,},{{elem1,elem2,}}] treats each expri as specifying the corresponding elemi.
  • Export["file.dif",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.dif",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the DIF format.


  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation elements:
  • "Data"two-dimensional array, representing the rows and columns stored in the DIF file
    "Grid"table data as a Grid object
  • Import and Export use the "Data" element by default.


Basic Examples  (1)

Import tabular data from a DIF sample file, formatting it as a table:

Click for copyable input
Introduced in 2007
| Updated in 2012