:topic: Importing Data to Spreadsheets

.. index::
   triple: DREAM3D-NX; Spreadsheets; Importing Data

.. _ImportingSpreadsheetsData:

Importing Data to a Spreadsheet
################################

**In this section we will go over how to import data 
into the Spreadsheet Toolkit.**

Import Data From A Pipeline
===============================
The first way to import data into the Spreadsheet toolkit is 
by running a pipeline. The following steps will detail how to 
import your data from a pipeline.

1. **Load or create your pipeline.** See the :ref:`Creating a Pipeline <CreatingAPipeline>` 
   section in User Interface Overview for more detailed instructions.

2. Click on the Visualization Preferences eyeball icon at the bottom of
   the Pipeline View and make sure **Spreadsheet Pipeline Results** is
   **checked**.
   
   +-----------------------------------+-----------------------------------+
   | Pressing “Visualization           | Viewing “Visualization            |
   | Preferences” Eyeball              | Preferences” Settings             |
   +===================================+===================================+
   | |image1|                          | |image2|                          |
   +-----------------------------------+-----------------------------------+

3. While the preferences dialog is still open, go to the General tab and find the 
   *Temp DREAM3D-NX Files Directory* option. This option will inform the Spreadsheet
   Toolkit how to import the data structure. If this option is enabled, the 
   Spreadsheet Toolkit will import the data by reading it in from the data structure 
   saved to this temp file. If this option is disabled, DREAM3D-NX will try to keep the
   pipeline's data structure in memory for accessing the data arrays. 

4. **Click the Run button** at the bottom of the Pipeline view to run
   the pipeline.

5. **Select the Spreadsheet tab** if it is not already active. In the DREAM3D-NX window containing 
   the pipeline you just ran, make sure the *Spreadsheet* tab is active.
   
6. Once your pipeline has completed, you will find the final data structure of 
   the executed pipeline loaded into the Data Structure tree view along the
   right hand side of the Spreadsheet tab. If the Spreadsheet toolkit already had 
   a data structure imported, it will reset the data structure view and 
   attempt to reload the Spreadsheet data.
   
Memory Usage Notes:  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Keep in mind that if you have out-of-core data, you must use the temp DREAM3D-NX file option (located 
  in the General tab of the preferences dialog) in order to use the Spreadsheet Toolkit

- If you have turned off the temp DREAM3D-NX file option (located in the General tab of the preferences 
  dialog) AND have not included a Write DREAM3D NX File filter at the end of your pipeline then the 
  application while keep your entire pipeline's data structure in memory when importing the data in to the 
  Spreadsheets Toolkit. Be careful about the size of your data and memory usage when running in this configuration.
  Please see the table below to check for the memory usage repercussions of the various configurations. 

   +---------------------+--------------------------------+--------------------------------------------------+
   |  Temp DREAM3D File  |  Write DREAM3D-NX File Filter  |  Notes                                           |
   +=====================+================================+==================================================+
   |  YES                |  NO                            | Data is read in on the fly from the temp file    |
   +---------------------+--------------------------------+--------------------------------------------------+
   |  NO                 |  YES                           | Data is read in on the fly from the .dream3d     |
   |                     |                                | file written in the Write DREAM3D-NX File Filter |
   +---------------------+--------------------------------+--------------------------------------------------+
   |  YES                |  YES                           | Data is read in on the fly from the .dream3d     |
   |                     |                                | file written in the Write DREAM3D-NX File Filter |
   +---------------------+--------------------------------+--------------------------------------------------+
   |  NO                 |  NO                            | The entire Data Structure is KEPT IN MEMORY.     |
   |                     |                                | Cannot be used with out of core data.            |
   +---------------------+--------------------------------+--------------------------------------------------+

   
Import Data From A File
===============================
The second way to import data into the Spreadsheet toolkit is 
by dragging and dropping a .dream3d file into the spreadsheet view. To do this simply make
sure the spreadsheet tab is active and then drag and drop the file from your system into the spreadsheet area. 
The data structure from your file will now be available on the right hand side for selecting data to add to your spreadsheet(s).

   
.. |image1| image:: Images/VisualizePipelineResultsOption.png
.. |image2| image:: Images/VisualizePipelineResultsOption2.png