Reference > Script steps reference > Records script steps > Import Records
 
Import Records
Purpose 
Imports records from a specified file or data source.
See also 
Format 
Import Records [Verify SSL Certificates; With dialog: On/Off; “<source or filename>”; Add/Update existing/Update matching; <platform and character set>]
Options 
Verify SSL Certificates verifies the SSL certificate of the server specified in an HTTP request for XML data. If the certificate cannot be verified, users can choose to connect anyway or cancel to skip this script step. If the certificate cannot be verified and the Set Error Capture script step is set to On, this script step behaves as if the server were unavailable.
With dialog specifies whether to display import-related dialog boxes when the script step is performed. However, if a data source file has not been specified, the Open File dialog box is displayed when a script is run.
Specify data source specifies the file or source of the data to be imported. Depending on the file or source you choose, a dialog box may appear for specifying the following additional options:
 
When you choose this file or source
Do this
File
In the Specify File dialog box, choose the file you want to import, or type file paths directly into the list. Specify one path per line. FileMaker Pro will use the first path it locates as the file to import. See Creating file paths.
Folder
In the Folder of Files Import Options dialog box, choose the folder of image or text files that you want to import, or type the folder paths directly into the list. Specify one path per line. FileMaker Pro will use the first path it locates as the folder to import. For more information, see Importing a folder of files all at once and Creating file paths. This option is not supported from scripts running on FileMaker Server.
XML Data
In the Specify XML and XSL Options dialog box, choose the source of the XML data that you want to import, and choose an XSLT style sheet if you want to apply one prior to import. The XML and XSLT source may be a file or the result of an HTTP request, or a calculation that generates a file path or an HTTP request. For more information, see Importing XML data.
ODBC Data
Specify the data source name and location, the user ID and password (if any), and the SQL query to be executed. You can enter a query directly or specify a calculation to generate the query. For more information, see Automating ODBC import using the Import Records script step.
SQL statements are limited to a maximum length of 256 K characters (512 KB).
Note  If you use the Import Records script step to import ODBC data that contains Unicode strings, your ODBC driver must support Unicode. Otherwise, the results may be inconsistent.
Specify import order tells FileMaker Pro to use a predefined import order. The last import order used in the file appears as the default and can be edited. This option also lets you choose whether to keep repeating field data together or to split repeating fields into separate records, as well as whether to add new records, replace data in the current found set, or import data as a new table.
Note  When import source fields and target fields are mapped using matching names, field name matching is performed dynamically each time the script step is performed.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server 
Partial 
FileMaker Go 
Partial 
Custom Web Publishing 
No 
FileMaker WebDirect 
Partial 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 6.0 or earlier
Description 
You can set the import order and use the Specify import order option, or perform this script step with the dialog box so the user can set new criteria, such as importing data as a new table.
If the source file is open, the found set is imported; if not, all records in the source table are imported.
If you include this script step in a server-side script and you do not set With dialog to Off, the text (NOT compatible) appears after the script step. The script, however, will run. The behavior will be the same as if With dialog is Off. See Get(DocumentsPathListing) function for more information.
If you run a server-side script to do any of the following, you will receive an error:
importing records to new table
importing records from a folder
importing images to a container field
Notes
When using the Import Records script step or Export Records script step in a server-side script, keep the following in mind:
Any specified file must be in the FileMaker Server Documents folder, the temporary folder, or a child folder of either the FileMaker Server Documents folder or the temporary folder. For example, the following are all valid paths for file.csv:
<Documents>/file.csv
<Temporary Path>/file.csv
<Documents>/Folder1/file.csv
<Temporary Path>/Folder1/Folder2/Folder3/Folder4/file.csv
Any path specified that isn’t a complete path to the file (for example, anything other than
/Macintosh HD/Library/FileMaker Server/Data/Documents/<0 or more directories>/<filename> ) is evaluated as being relative to the temporary path.
Any paths that include “..” are considered invalid.
For FileMaker Pro, if an absolute path is not specified in a script that will be executed from FileMaker Pro, the path is assumed to be relative to the location of the database file from which the script was run. For example, if a script containing the Export Records script step is run with the pathname file:/export.tab, and the file running the script is /MyFiles/Library/Books.fmp12, the exported file will be created as /MyFiles/Library/export.tab.
Support for importing photos from a digital camera or device has been removed from FileMaker Pro.
If a script created in an earlier version of FileMaker Pro contains an Import Records [Digital Camera] script step, the step is commented as obsolete. You can remove the step, but you can’t edit it.
If a button references an Import Records [Digital Camera] script step, the button is disabled and the Import Records script step is commented as obsolete in the Button Setup dialog box.
FileMaker Go only supports importing from one FileMaker Pro file to another FileMaker Pro file.
FileMaker Go does not support importing to a new table.
When using this script step in FileMaker WebDirect, keep the following in mind:
FileMaker WebDirect does not support this script step in mobile browsers.
FileMaker WebDirect does not support the With dialog or Specify data source options.
FileMaker WebDirect only supports importing from Comma-Separated Text, Tab-Separated Text, DBF, Merge, and Excel file formats.
Example 1 
Imports information from New Product Catalog.xlsx as new records without prompting the user.
Go to Layout ["Products"]
Import Records [With dialog: Off; Source: "New Product Catalog.xlsx"; Worksheet: "Stock"; Add; Mac Roman]
Example 2 
Updates existing records with information from New Product Catalog.xlsx.
Go to Layout ["Products"]
Sort Records [Restore; With dialog: Off]
Go to Record/Request/Page [First]
Import Records [With dialog: Off; Source: "New Product Catalog.xlsx"; Worksheet: "Stock"; Update matching; Mac Roman]
Example 3 
Sets the next serial value after importing records. Useful when Perform auto-enter options while importing is not selected to preserve dates and other auto-entries.
Go to Layout ["Products"]
Import Records [With dialog: Off; Source: "New Product Catalog.xlsx"; Worksheet: "Stock"; Add; Mac Roman]
Set Next Serial Value [Invoices::Invoice ID; Get ( TotalRecordCount ) + 1]
Sort Records [Restore; With dialog: Off]
Go to Record/Request/Page [First]
Related topics 
Set Next Serial Value script step
Export Records script step
Script steps reference (alphabetical list)
Script steps reference (category list)