Worksheet to Text
The Worksheet to Text function exports an entire worksheet in the workbook to a text file in the file format specified.
Settings | |
|---|---|
Format | The file format for the export file in either CSV or Text formats. |
Directory | The directory where the text file is stored. If this is left blank, the text file is stored in the Reports Directory of the current project (as defined in the Project Explorer). If this is not a full path reference, the setting is used as subfolders of the Reports directory. If any part of the directory does not exist, it is created. 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. Note that some keywords, such as {DATIM} contain illegal directory characters when evaluated. These keywords cannot be used for the directory. |
File | The name of the text file with or without a file extension. If the file extension is not specified, then it is either CSV or TXT according to the Format setting. If this setting is left blank, the text file is named after the target workbook and worksheet (as specified in the template) in the format Workbook_Worksheet.FileExtension where FileExtension is either CSV or TXT. Note that keywords for the date and time can be entered for the file name e.g., entering {MMM}_{DD}_{YYYY}.csv will name a file generated on June 1st 2020 as Jun_1_2020.csv. Note that some keywords, such as {DATIM} contain illegal file name characters when evaluated. These keywords cannot be used for the file name. This setting may also be specified as a cell reference. |
Overwrite | If set to Yes, the text file is overwritten if it exists. If set to No and the file exists, nothing is done. |
Example
An analysis application requires 15-minute samples on equipment over the day to monitor how efficiently the plant is operating. That application cannot directly interface with the process historian but can import CSV files.
In this case, XLReporter can act as middleware to get the data from the process historian and export the CSV file for the analysis application. To accomplish this, a history data group is configured to retrieve the 15-minute samples and a Worksheet to Text management function is configured to export the data to CSV. The settings are:
Setting | Value |
|---|---|
Format | CSV (Comma Delimited) |
Directory | \\FileServer\Analysis |
File | {YYYY}-{MM}-{DD}.csv |
Overwrite | No |
Where FileServer is the name or IP address of the target location.