OriginLab Corporation - Scientific Graphing and Data Analysis Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis

impCSV

Contents

Menu Information

Comma Delimited (CSV)

Brief Information

Import csv file

Command Line Usage

impCSV fname:="c:\test.csv"

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
File Name fname

Input

string

fname$

Specify the filename of the file to be imported.

File Info trfiles

Input

TreeNode

<unassigned>

This is used to show the file size in the dialog. The information is detected by Origin automatically.

Import Options options

Input

TreeNode

<unassigned>

This is mainly used in the dialog, for tweaking the import options. Please see the Descriptions section for details.

Output orng

Output

Range

<active>

Use this to specify the output range. See the syntax here.

Header Info trheader

Output

TreeNode

<optional>

This is for outputting the header information. It is hidden from the GUI. Users are not advised to use this variable from Labtalk.


Repeat import reimp

Input

int

0

This is used for the reimport feature. It is hidden from the GUI. Users are not advised to use this variable from Labtalk.

Description

CSV (comma-separated values) is one kind of delimited file, which as the name suggests, uses commas to separate values. This X-Function helps you to import this kind of file.

Details on Some Dialog Options

Please see this page for more details.

Examples

1. The following example imports a CSV file into a new book and renames the book with the filename:

a. From the Origin menu, select File: Import: Comma Delimited (CSV). This opens the Comma Delimited File dialog for you to choose the import files.
b. Browse to the folder where your data file is. Select the file and click the Add File(s) button. Click OK to close the dialog box.
c. In the impCSV dialog box, expand Import Options. Select Start New Books for 1st File Import Mode. Make sure that Rename Book with (partial) Filename is checked and Trim Filename from and Trim Filename to below it are 1 and 0. Click Ok to close the dialog.

2. The following script command imports a CSV file (c:\test.csv) without opening the dialog:

Fname$="c:\test.csv";
impCSV;

Related X-Functions

impFile, impinfo