# ImportData

The ImportData function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. imports Cell Data (.cxd) files exported with the ExportData function, cell by cell, from one of the following locations:

- Flash memory of a local vision system

- FTP server

- SFTP server

ImportData automatically inserts a .cxd file into the spreadsheet according to a predetermined event.

Note: The ImportData function cannot import .cxd files from the Snippets folder on the PC.

When you import a .cxd file, the data becomes part of the ImportData function and cannot be edited. When you click on an imported .cxd file, the ImportData property sheet opens and not the property sheet for the data type that was imported.

You can import the following data types:

- CountPassFail: For more information, see CountPassFail.
- Calibrate: For more information, see Calibrate.
- CalibrateGrid: For more information, see CalibrateGrid.
- ExtractCalibration: For more information, see ExtractCalibration.
- OCRMax: For more information, see OCRMax.
- OCRMaxSettings: For more information, see OCRMaxSettings.
- ShiftRegister: For more information, see ShiftRegister.
- TrainPatMaxRedLine: For more information, see TrainPatMaxRedLine.

## ImportData

Inputs

The ImportData function has the following syntax:

ImportData(Event, Host Name, User Name, Password, File Name)

See the table for a description of the available parameters.

Parameter | Description
--- | ---
Event | Specifies the update event on which to import data. This parameter must be a reference to one of the following: The image data structure in cell A0 , containing the AcquireImage function. For more information, see AcquireImage. Note: If you write the data to flash memory and the Event is set to the Image data structure, the function returns an #ERR. A cell containing an Event function. For more information, see Event. A cell containing a Button function. For more information, see Button. Note: The default setting of the Event parameter for the ImportData function is 0. When the parameter is 0, an ImportData button is created next to the ImportData cell.
Storage | Specifies where the data is stored. You have the following options: Local Device FTP Server SFTP Server
Host Name | Name or IP address of the server where you save the file. Only available when you select FTP/SFTP server as Storage. Note: If the server is unavailable at the time of the data transfer, it takes several seconds to time out. In-Sight Spreadsheet can disconnect from the vision system if this occurs.
User Name | Specifies the username accessing the server. Only available when you select FTP/SFTP server as Storage.
Password | Specifies the password accessing the server. Only available when you select FTP/SFTP server as Storage.
File Path | Specifies the data file path. If left blank, ImportData uses the default device directory. ImportData supports all valid absolute or relative PC paths.
File Name | Specifies a custom name for the file. If the file name already exists on the target location, the existing file is overwritten. Note: Do not enter a file extension. It is automatically added to the string.

Outputs

The imported data corresponds to the data structure contained in the exported cell. For example, if an integer is imported, the cell displays the integer value; if a Calib structure is imported, the cell displays the Calib structure. However, if you double-click on the Calib structure, the ImportData property sheet opens and not the Calib structure property sheet.

ImportData imports a .cxd file when one of the following occurs:

- You click the OK button on the ImportData property sheet.
- The tool receives an Event.
- The ImportData Event parameter is ON (or points to a non-zero numeric value), and any one of the ImportData input parameters is updated.
- You load a job A job is a user-configured program in In-Sight Spreadsheet consisting of functions and designed for specific applications. You can create and edit jobs using the In-Sight Spreadsheet interface, and load them on a vision system for deployment in a live environment. with an ImportData function.

Note: ImportData works in Offline mode as well.

## ImportData Example

ImportData(A0,"192.168.0.100","admin","",

Whenever the spreadsheet updates after an image capture, the function imports the data as a file called PartXPattern.cxd from the server with the IP address 192.168.0.100. The user name is admin and the password is left blank.