9.2.2 Import Wizard
The Import Wizard allows you to import complicated ASCII files, extract variables from the import file name and header (for reuse in Origin), specify custom delimiters and date formats, or handle post-processing of your imported data using a custom LabTalk script. Moreover, you can save your custom settings to a filter (.oif) that can be used repeatedly to import the same or similarly-structured files.
What you will learn
This tutorial will show you how to use the Import Wizard to
- extract variables from both the file name and file headers
- save import settings and use it for new data
- Strat with a new workbook. Select from menu Data: Import From File: Import Wizard to open the Import Wizard dialog. Click the browser button to the right of the File box. Browse to the folder \Samples\Import and Export and select the file S15-125-03.dat.
Note that an import filter of VarsFromFileNameAndHeader.oif is auto-selected for Import Filter> Import Filters for current Data Type. By default, if there is any import filter in the data folder, the filter will be auto-used to import the data. In this example, we will show you how to import this data step by step and create a similar filter. So we choose <None>.
- The Header Lines page enables you to easily customize the worksheet headers. The lower preview panel is especially helpful when you are importing a file with many lines of header like this example. Clear Auto determine header lines check box. To specify the main header lines, place the cursor on line 6 in the preview panel, and then click the button next to Main Header Lines: Fixed Number. Similarly, specify the Long Name and Unit line.
- The Variable Extraction page allows you to extract variables from file name and file headers, which can be saved in page info, put into column header lines, or used in annotating a graph. Select Specify location of variable names and values using delimiters, Add variables to page info and Create User Parameter rows for each variable.
- The Variable Extraction by Delimiter page allows you to extract variables name and value by specified delimiter. In this example, we extract the following:
- Variable in Line FN04, Delimiter = Other: -,
- Value = S15, Enter variable name = SampleID;
- Value = 125, Enter variable name = BatchNo;
- Value = 03, Enter variable name = RunNo;
- Variable in Line H002, Delimiter = Colon, Value = 1000, Extract variable name from file > Name = No. of points;
- Variable in Line H004, Delimiter = Colon, Value = 12/01/2004, Extract variable name from file > Name = Measured on;
- Variable in Line H005, Delimiter = Tab, Value = 03:20:39 AM, Extract variable name from file > Name = Time;
- Variable in Line H006, Delimiter = Tab, Value = Trial Run 1, Extract variable name from file > Name = Run Type;
- On the File Name Options page, select worksheet with variable checkbox and choose RunType from the combo box drop-down list to rename the worksheet by variable RunType. Also select Rename Long Nmae for Book only and Append file name to column comments.
- On the Data Columns page, select Tab for Column Separator > Delimiter, and enter XY for the Column Designations. Click Apply button to preview the data columns in the bottom panel.
- Click Next twice to go to the Save Filters page. To use these settings again, you can save this import procedure as a filter. Select the Save filter check box and type a filter name in the Filter file name text box (MyFilter in this example).
Click Finish to import the data.
- Open Import Wizard dialog again. This time, select file <Origin installation folder>\Samples\Import and Export\S21-235-07.dat. You can select MyFilter filter just saved from Import Filters for current Type.
Click Finish button directly. The settings in MyFilter will be used to import the file.