How to | Import and Export File Elements

Sometimes you may want to work with a specific part of a file instead of all of it. When bringing a file into the Wolfram Language, you can elect to import just individual parts of the file, which are called elements. The Wolfram Language's ability to import and export elements of files gives you greater control over the information being exchanged while simultaneously saving time and memory.

Begin by importing an image from the Wolfram Language documentation directory ExampleData:

Use "Elements" as the second argument in Import to view the elements of the image that are available for import:

Get the pixel size of the image:

Import the complete "Rawdata" of the image and set it to the variable data. Since data is large and you do not need to view all of it, the output is suppressed here with a semicolon:

You can now analyze the image data, for example by using ListPlot3D:

    

After importing, you can then export elements to control exactly what is exported. This gives you a great deal of extensibility when working with data in different files and formats.

Import the first sheet of data from the spreadsheets "population.xls" and "elements.xls" from the Wolfram Language documentation directory ExampleData:

Export these to separate sheets in a single spreadsheet file:

The specific Import and Export elements that can be used depend on the file formats you are working with. For more information, see the documentation pages for the formats. There is also some additional information in How to: Import and Export.