OpenersPrimaryExamplesSection(Spacer1)Examples  (5)

OpenersExampleSection0(Spacer1)Basic Examples  (5)

Export an array of random numbers as a table:

ExportString[RandomReal[10,{4,3}],"Table"]

Export a table formatted as a grid:

Export["grid.dat",({{1, x-1, 2}, {2, (x-1) (x+1), 3}, {3, (x-1) ((x^2)+x+1), 4}, {4, (x-1) (x+1) ((x^2)+1), 4}, {5, (x-1) ((x^4)+(x^3)+(x^2)+x+1), 4}, {6, (x-1) (x+1) ((x^2)-x+1) ((x^2)+x+1), 6}, {7, (x-1) ((x^6)+(x^5)+(x^4)+(x^3)+(x^2)+x+1), 4}})]

Import the generated file:

Import[%]

Use (RefLink[ExportString, paclet:ref/ExportString]) to create a formatted version of an array:

ExportString[ {{10, 1000000, 100}, {1, 10, 10000}}, "Table","FieldSeparators"-> " ", Alignment-> Left]

Import a tabular data file that uses vertical bars as field separators:

Import["ExampleData/buildings.dat","FieldSeparators"->" | "] // Grid

(RefLink[Import, paclet:ref/Import]) converts dates to a Wolfram Language (RefLink[DateObject, paclet:ref/DateObject]) specification if the date format is specified:

ImportString["01/19/00 \n 05/18/02 \n 12/14/04","Table", "DateStringFormat" -> {"Month","/","Day","/","YearShort"}]

Create a UTF-8 encoded text file that contains currency tokens:

Export["exchangerate.txt","$1.00  ¥116.65  €0.7509"]

When importing this file, currency tokens are automatically skipped:

Import["exchangerate.txt","Table",CharacterEncoding->"UTF8"]

The Wolfram Language automatically converts expressions to a list of lists when exporting to the Table format:

ExportString[{1,{1,2,3}}, "Table"]

ImportString[%,"Table"]

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Basic Formats, paclet:guide/BasicFormats])}, {▪(RefLinkPlain[Date & Time, paclet:guide/DateAndTime])}, {▪(RefLinkPlain[Importing & Exporting, paclet:guide/ImportingAndExporting])}, {▪(RefLinkPlain[Listing of All Formats, paclet:guide/ListingOfAllFormats])}, {▪(RefLinkPlain[List Manipulation, paclet:guide/ListManipulation])}, {▪(RefLinkPlain[Numerical Data, paclet:guide/NumericalData])}, {▪(RefLinkPlain[String Manipulation, paclet:guide/StringManipulation])}, {▪(RefLinkPlain[Tabular & Spreadsheet Formats, paclet:guide/TabularAndSpreadsheetFormats])}})}})