DIF (.dif)

Background & Context

    • 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 & 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 following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • 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.

Examples

Basic Examples  (1)

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