Origin supports drag-and-drop import for many common file types. For historical reasons, there are multiple technologies used. When you drop a file onto an Origin worksheet or matrixsheet, a code-checking sequence occurs that determines which method is used. See Import Code Reading Sequence, below.
Note: You will not be able to drag and drop files if you are running Origin as an administrator. |
When files are dropped into Origin, this sequence occurs:
![]() | Drag-and-drop behavior for .dat, .xls/xlsx, .txt and .csv, can be modified by setting system variable @IFS. See Notes in the next section. |
Data Connectors are Origin's newest data import technology. Data Connectors offer simple import for common data files such as Text/CSV and Excel. Files are often handled automatically, without the need for configuration of dialog boxes or saving of settings to the sheet or to an external filter file. Both Text/CSV and Excel Connectors do a good job of handling date-time data: data should be automatically recognized and formatted in the sheet on import.
If you have been using an Origin Import Filter (*.oif) -based routine, it should still be fully-supported (see Note, below). However, we encourage you to try importing your data using one of the available Connectors (Data: Connect to ...). Also, note that you can use your import filter with a Data Connector (Data Connect to File: Import Filter).
When using one of the X-Function based dialogs for file import -- those found under Data: Import from File -- you have the option of saving the current dialog box configuration to a Dialog Theme or to Save Settings for Drag and Drop.
When you Save Settings for Drag and Drop, you are saving an import filter to the sheet itself. As long as the sheet -- or a duplicated sheet is active -- you can then drop new files of identical file type and structure and have them imported cleanly into the sheet.
The Import Wizard supports import of ASCII and simple Binary files ("simple" being an optional header section followed by a sequential binary structure). If your data do not fall easily into one of those two categories, you can write your own Origin C code (User-Defined) to handle data import.
Regardless of Data Type, one of the chief advantages of using the Wizard to import your data files is that you can save your custom settings to an Origin import filter (*.oif) that can be used repeatedly to import identically-structured files. Once you've created your filter, subsequent files are easily imported by drag-and-drop.
When creating an import filter, the normal sequence of events is to open the Import Wizard, select a data file, then step through a sequence of Wizard pages in which you interactively parse the file, select file and window naming options, select header information to be stored and re-used, etc. When you have finalized your import settings, you can store them as an import filter (saving the filter is highly recommended if you plan to import the same or similar files in the future).
When creating an import filter, you have the option of saving the filter (a) in the data file folder, (b) in the User Files folder or (c) in the Window. All options support drag-and-drop file import.
One advantage of saving the filter in the Window is that the filter travels with the window itself and, thus, it becomes part of the Origin project file (*.opju) or child window file (*.ogwu).
The two other options (data file folder or User Files folder) require saving the filter as a separate *.oif file. The primary advantage here is a greater degree of flexibility when importing. You can choose to always use the filter (data folder) or to opt not to use the filter and use a Data Connector instead (by clearing the User filter's Support Drag&Drop check box in Filter Manager (Preference: Import Filters Manager); or -- another great option -- to use a Data Connector with your import filter file settings (Data: Connect to File: Import Filter).
Once created, an import filter file can be tweaked to import files that vary somewhat in their structure, without having to completely recreate every import specification. The procedure here would be to open the Wizard, (1) pick the file for which you intend to modify your import filter, (2) load the import filter (you may have to clear the List filters applicable... check box to list User filters), (3) step through the Wizard, modifying settings as needed and (4) on the Save Filters page of the Wizard, save your filter settings to a new name.
Your import filter can be narrowly-defined to work only with a particular file name (or variations on that file name) or it can be broadly-defined to apply to all files with a given file extension. For instance, you might work with an instrument that automatically names data files in sequence using a scheme something like XYZ_001.CSV, XYZ_002.CSV, XYZ_003.CSV. Using the "*" wildcard character, you could broadly target the filter to all .CSV files in your data file folder by specifying that the filter apply to any file with the name "*.CSV." Conversely, you could narrowly-target the filter by specifying that the filter apply only to CSV files named "XYZ*.CSV."
When defining an import filter for ASCII, binary or user-defined file types, you must specify a Target Window and Target Window Template. Note that only Data Type = User-Defined allow specifying something other than Target Window = Workbook. Note, too that User-Defined allows you to bypass specifying the Target Window and Target Window Template (Target Window = None) if window creation is to be handled by your Origin C code (in which case, the code would handle window creation).
Assuming that you have defined an import filter, if you drag-and-drop one or more data files into an active window and that window is of the Target Window type, then Origin will import the file(s) using the new window/new worksheet/new column settings specified in the filter. If, for instance, (1) the filter Import Mode is set to Start New Columns and (2) the file(s) are dropped onto a workbook window (the Target Window type specified in the filter), then the file(s) are imported and added as columns into the active worksheet in the active workbook. If the active sheet had empty columns, they would be filled first. In this case, the active workbook was of the correct Target Window type and each file required only the creation of new columns. No new windows needed to be created so, therefore, the Target Window Template was not used.
If the filter Import Mode had been set to Start New Books, then the first file dropped would import into the active workbook if the columns in the active sheet were empty (again -- the Target Window was of the correct type), and each subsequent file would import into new workbook windows created using the Target Window Template. Note that the Target Window Template may, or may not, be the same template that the active workbook window was based upon. However, the default Target Window Template (<Default> from the drop-down list on the Import Wizard Source page) is the default Origin worksheet or matrix template. Unless you have chosen a different default template, this would be ORIGIN.OTW (worksheet) or ORIGIN.OTM (matrix).