9.2.2 Import Wizard

Summary

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

Steps

  1. Strat with a new workbook. Select from menu Data: Import From File: Import Wizard to open the Import Wizard dialog. Click the browser button Tutorial Import 005.png to the right of the File box. Browse to the folder \Samples\Import and Export and select the file S15-125-03.dat.
    Tutorial Import 013.png

    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>.
    Click Next.
  2. 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 Tutorial Import 012.png next to Main Header Lines: Fixed Number. Similarly, specify the Long Name and Unit line.
    Tutorial Import 002.png

    Click Next.
  3. 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.
    Tutorial Import 014.png

    Click Next.
  4. The Variable Extraction by Delimiter page allows you to extract variables name and value by specified delimiter. In this example, we extract following info into several variables:
    • Variable in Line FN04, Delimiter = Other: -,
    • Value = S15, Enter varialbe name = SampleID;
    • Vluae = 125, Enter varialbe name = BatchNo;
    • Vluae = 03, Enter varialbe name = RunNo;
    • Variable in Line H002, Dlimiter = Colon, Value = 1000, Eetract variable name from file > Name = No. of points;
    • Variable in Line H004, Dlimiter = Colon, Value = 12/01/2004, Eetract variable name from file > Name = Measured on;
    • Variable in Line H005, Dlimiter = Tab, Value = 03:20:39 AM, Eetract variable name from file > Name = Time;
    • Variable in Line H006, Dlimiter = Tab, Value = Trial Run 1, Eetract variable name from file > Name = Run Type;
    Tutorial Import 004.png

    Click Next.
  5. On the File Name Options page, select worksheet with variable box is checked and select RunType from the combo box drop-down list to rename the worksheet by variable RunType.
  6. Click Next to go to the Data Columns page. Select Tab for Column Separator > Delimiter , and enter XY for the Column Designations. Click Apply.
    Tutorial Import 007.png
    to preview the data columns in the bottom panel.
    File:Tutorial Import 008.png

    Click
  7. 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).
    Tutorial Import 009.png

    Click Finish to import the data.
    File:Tutorial Import 011.png
  8. OpenImport 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.
    Tutorial Import 010.png
    Click Finish button directly. The settings in MyFilter will be used to import the file.