9.1.1 Importing Data


Origin provides flexible ways of importing data including simply dragging and dropping data files, using the ASCII import dialog to customize settings, using the Import Wizard for advanced customization and for extracting variables from header lines, and supporting custom file formats for many third-party files. This tutorial will highlight some of these features.

Note: This tutorial requires you to drag-and-drop data files onto Origin, so please make sure you are not running Origin as administrator.

What you will learn

This tutorial will show you how to:

  • Import files by drag-and-drop
  • Import multiple ASCII files by customizing settings
  • Saving settings for future use
  • Import Wizard and import filters

Drag and Drop Importing of ASCII Files

  1. Start with an empty worksheet. Open Windows Explorer to the \Samples\Curve Fitting subfolder of your Origin installation folder. Drag and drop the file sensor01.dat from the Windows Explorer window into the empty Origin worksheet.
    Tutorial Importing Data 001.png
  2. Data comes into the sheet. Now select two files: sensor02.dat and sensor03.dat and drop into the same worksheet. You will see that the first file replaces the data already in the worksheet, and the others create new workbooks, as the default setting is to create new books for the 2nd file.

The default setting when dragging and dropping is to replace existing data. If you have some other data already in the sheet, you can drop the file onto the gray area outside of any window, or into a graph window, and Origin will create a new book and import the data.

Customizing ASCII Import Dialog Settings and Saving a Theme

ASCII import and custom-file-format import both provide an options dialog where a user can customize import settings and then save settings for later use on similar files.

  1. Start with a new book and click the Import Multiple ASCII button Button Import Multiple ASCII.png on standard toolbar.
  2. Select the files sensor01.dat, sensor02.dat from \Samples\Curve Fitting and add to lower panel of the file dialog. Click the file name column header in lower panel to sort the files by name. Keep the Show Options Dialog box checked and click OK. This will open a dialog for import settings.
    Tutorial Importing Data 002.png
  3. Change import mode to Start New Sheets. Expand (Re)Naming Worksheet and Workbook node and change settings so that only sheet gets renamed.
    Tutorial Importing Data 003.png
  4. Click on right arrow button at the top of the dialog and select Save As, then give it a name such as My Multifile Import and click OK. This saves your settings to a theme file on disk.
    Tutorial Importing Data 004.png
  5. Click OK and the 1st file gets imported into the current sheet, and a new sheet is created for the 2nd file. File names are used as sheet names.
    Tutorial Importing Data 005.png
  6. Now start a new book and invoke the menu Data: <Recent used items> impASC: My Multifile Import. In the file dialog pick the three files: step01.dat, step02.dat, step03.dat from \Samples\Curve Fitting. Click the file name column header in lower panel to sort the files by name. Click OK. The settings from the theme you saved and selected here are used to perform the importing.

When doing serial import of files to new sheets (Start New Sheets), note that the workbook can contain a maximum of 255 sheets (prior to Origin 2018) or 1024 sheets (Origin 2018 and later). When the maximum number of sheets is reached, a new book is created.

Saving ASCII Import Settings to Worksheet

Custom ASCII import settings is by default saved into the worksheet itself. It can also be saved as a theme file to disk. Please note that settings saved in this way can only be reused when import with the impASC dialog. If you want to use the settings when drag-n-drop to import a data file, you will need to use Save Settings for Drag and Drop menu.

  1. Start with new book and invoke Data: Import from File: Single ASCII from menu, and select the file sensor01.dat from \Samples\Curve Fitting subfolder, and keep the Show Options Dialog checked and click OK.
  2. In the ImpASC dialog, unfold Import Options branch, select No with the Add Sparklines drop-down list. Expand (Re)Naming Worksheet and Workbook node and change settings so that only sheet gets renamed by file name, not book.
  3. Click on Top Arrow icon and select Save Settings for Drag and Drop and click OK. Then your custom settings get saved to the sheet and data is imported.
  4. Select File: Save Template As from the main menu. Enter SensorImport as the template name. Click OK to save the workbook template. This template contains both the import settings and the worksheet properties settings.
  5. Now we create a new workbook from this template. Click the Open Template button on the Standard toolbar. Select SensorImport.otw under your User Files Folder and then click Open. A workbook is created from the template.
  6. With this book active, drag and drop the file sensor02.dat. The data gets imported and only sheet name changes to the new file name. The sparklines were not turned on.

When saving custom settings to a worksheet, it is useful to then save the sheet, along with other desired analysis operations, as an Analysis Template for repeat analysis of similar data from multiple files. See the Batch Processing tutorial for details.

Import Wizard and Import Filters

The Import Wizard allows you to step through your data file, customize settings including how to parse header lines to create variables, and then save all of your custom settings as an import filter (.OIF) file for repeat use. The filter file can reside in the data folder, in the \Filters sub folder of your User Files Folder, or even saved to the worksheet itself for use with Analysis Templates. The Wizard is typically useful when the file has header lines that need to be parsed, or the file needs custom settings such as fixed width, or for executing LabTalk script at the end of the import for post processing.

  1. Start with a new book. Click on the Import Wizard button Button Import Wizard.png in the Standard toolbar to launch the wizard.
  2. Select the file \Samples\Import and Export\S15-125-03.dat.
  3. Note that the Import Filter for Current Data Type drop-down changes to show Data Folder: VarsFromFileNameAndHeader, this is a filter already created for this file and shipped with Origin, and is automatically picked up from the same folder as the data file you chose. Then change Import Mode to Replace Existing Data.
    Tutorial Importing Data 008.png
  4. Click Next and walk through the pages. Notice controls on Header Lines pages that allows flexible definition of where the header lines end, where the sub header lines are located, and what gets assigned to long name and units etc.
  5. For this file the Variables Extraction and Variables Extraction by Delimiter page define how to parse the header lines to extract values from them.
  6. Click Next until you get to the Save Filters page. Check the Save filter box and change the radio button to In the Window. This will save the filter in the active worksheet.
    Tutorial Importing Data 009.png
  7. Now check the Specify advanced filter options. It brings you to a last page where script (to run at the end of the import) can be specified. In Script after Each File Imported edit box enter:
    col(E)[l]$=Delta Temperature;

    Tutorial Importing Data 010.png

  8. Click Finish, the file gets imported and the import filter is now saved in your worksheet. The fifth column is a column added by the script. It is the Delta Temperature data in Degree Celsius.
  9. With the worksheet active, click Import Wizard button again and pick file \S21-235-07.dat. Note that the Import Filter for Current Data Type drop-down shows <use filter in active window>, so Origin picks up the filter settings that were saved in the worksheet.
    Tutorial Importing Data 011.png
  10. Click Finish and the file gets imported and the script gets executed (the values in column 5 is updated).

You can save the import settings to the worksheet, perform analysis on the imported data, and save the workbook as an analysis template for repeat processing of similar data files. See the tutorial on batch processing for more information.