Skip to main content

From Text File

The From Text File function imports the content of a text file into a worksheet.

Settings

Directory

The directory where the text file to import exists. If this is left blank, the Reports Directory of the current project is used (as defined in the Project Explorer). If this is not a full path reference, the setting is used as subfolders of the Reports Directory.

This can be a fixed name or cell reference where the cell reference contains the directory. Fixed names can contain XLReporter Name Types like {YYYY}, {MMM}, etc. See the Name Types chapter for the full list of supported keywords.

Text File

The name of the text file to import.

This can be a fixed name or cell reference where the cell reference contains the directory. Fixed names can contain XLReporter Name Types like {YYYY}, {MMM}, etc.

If this setting contains a full path, that path is used as the Directory.

In addition, the Text File can be specified with a wildcard. This changes the setting from a specific file name to a filter that is used to get the most recent file in the Directory specified. For example, a Text File of Flow*.csv would import data from the most recent file in the Directory that starts with Flow and ends with .csv.

Delimiter

This setting defines how the values are separated in the file. A drop-down list of common separators is provided to select from, or a custom delimiter can be manually entered.

Rows in Header

This setting defines how many rows in the text files should be considered header rows. If the Placement Type is set to any of the Insert options, when the text file data is written, the header rows will appear at the top/left base on the Placement Cell and Direction without any inserting, and then the data itself is inserted. For any other Placement Type this setting is ignored.

Example

To extract the content of an hourly CSV file directly into an Excel workbook the following settings would be used:

Placement

Cell

$B$4

Type

Offset

Direction

Down

Offset

hD

Setting

Value

Directory

C:\MyCSVFiles

Text File

{YY}-{MM}-{DD}_{hh}_Station 1.CSV

Delimiter

Comma

Rows In Header

0