9.2.3 Importing Multiple Files into Workbooks Cloned from Active Workbook

Video Image.png Video Text Image.png Website blog icon circle.png Blog Image 33x33px.png


Origin provides an easy way to "clone" import and analysis operations in the active workbook. This powerful feature allows you to process a group of files quickly with no more than a few button clicks.

This feature is implemented for most of Origin's supported import file types, e.g., ASCII, CSV, Excel, and will work with the older X-Function based routines (Data: Import From File) or the newer Data Connectors (Data: Connect to File). This tutorial makes use of the newer Connector technology but the methods are essentially the same for the older X-Function based import routines.

What you will learn

This tutorial will show you how to:

  • Create a prototype workbook.
  • Clone the workbook by importing and analyzing a group of similar data files.

Import Multiple ASCII Files into Cloned Workbooks

Create a Prototype Workbook

In this example we will import a file, make a scatter plot and perform a linear fit on the data, and embed the graph with fit results in our workbook.

  1. Start a new project. From the menu, choose Data: Connect to File: Text/CSV.
  2. Browse to the <Origin Installation Path>\Samples\Curve Fitting\ folder and select Sensor01.dat.
  3. Accept default settings in the CSV Import Options dialog, and click OK. The data file is connected to the worksheet.
  4. In the worksheet, click on the column B header to select the column, then click the Scatter button.
  5. Highlight column B (Sensor Output) and choose Plot: 2D: Scatter : Scatter to plot a scatter graph.
  6. Double-click on X axis to open the Axis dialog. Click on the Scale tab, press the CTRL key and choose both Horizontal and Vertical in the left panel. Set Rescale = Auto and click OK.
  7. Choose Analysis: Fitting: Linear Fit menu to open Linear Fit dialog. Set Recalculate = Auto (optional -- see tip below) and click OK to perform the fit. Answer No to the Reminder Message and click OK.
  8. Right-click in gray area to the right side of the Sensor01 worksheet and choose Add Graph:[Graph1]. The Scatter plot with linear fit curve will show as a floating graph on Sensor01.
Import Multiple Files Clone Active Workbook 02.png

In step 7., you were asked to set the Recalculate mode to Auto. Beginning with Origin 2018b, this step is not necessary as cloned imports automatically trigger recalculation. If you were using earlier versions of Origin with the ASCII import dialog box, you could invoke the same behavior by putting the following line of script into the Script after Each File Imported box (under the Scripts branch) of the ASCII dialog box.

run -p au;
ASCII clone run-p au2.png

Import Multiple Files and Perform Analysis by Cloning the Workbook

In this portion of the tutorial, we will "clone" all of the operations associated with Book1, including graphing and performing a linear fit, by importing more Sensor data files.

  1. With Book1 active, click the Clone Import button Button Clone Import.png on the Import toolbar.
  2. Browse, again, to the Curve Fitting folder and use the SHIFT or CTRL keys to select files Sensor02.dat ... Sensor07.dat, click Add File(s) and then OK. All files are processed and the resulting graph and fit curve are embedded as a floating graph on each worksheet.
Tutorial clone import and linear fit.png