Hitachi

JP1 Version 13 JP1/Automatic Operation Service Template Reference


4.13.9 Excel to CSV file convert

Function

This plug-in converts Microsoft Excel files (*.xlsx, *.xlsm, *.xls) to CSV files (*.csv).

This plug-in can be used for files that meet the following conditions:

- The file can be edited in Microsoft Excel.

- For Excel files, the file must have the xls extension (Excel format saved as "Excel 97

- 2003 book") or the xlsx or xlsm extension (Excel book or Excel macro enabled book).

This plug-in requires the following server:

- Execution-target server

The server on which this plug-in is to be executed. In a Windows environment, the

prerequisite version of Microsoft Excel must be installed on this server

The script in this plug-in performs the following processing:

The sheet specified by the sheet name (common.sheetName property) of the EXCEL file for

input specified by the file name (common.fileName property) is opened in Microsoft Excel

and saved as a CSV file.

#: The temporary file and output files are assigned a name that is made by concatenating

the following elements:

- Path of the folder to which the file is output (value of the common.outputFolderPath

property)

- Folder delimiter character "\"

- The character string of the original file name excluding the file extension.

- ".csv"

A wildcard (*) can be specified as a partial match for the file name (common.fileName

property).

If a wildcard (*) is specified for the file name (common.fileName property), the conversion

process for the sheet name (common.sheetName property) of the EXCEL file is executed for

multiple files.

When saving a CSV file, the file format xlFileFormat is specified in the following method

of Office Visual Basic for Applications (VBA)

Workbook.SaveAs (

"value-of-file-name-(common.fileName-property)",#1

value-of-xlFileFormat#2

)

#1: If a wildcard is specified for value-of-file-name-(common.fileName-property), the

corresponding file is specified.

#2: If DEFAULT is specified for the character encoding type (common.characterEncoding

property) for value-of-xlFileFormat, 6(CSV) is specified. If UTF-8 is specified for the

character encoding type (common.characterEncoding property) for value-of-xlFileFormat,

62(UTF8 CSV) is specified.

If the folder specified as the destination folder path for file output

(common.outputFolderPath property) does not exist, the folder is created and is used as the

output destination for the output files. If an existing file has the same name as an output

file, that file is overwritten.

In addition, when using 32-bit version of Microsoft Excel, if the following folder does not

exist, the folder is created.

%SystemRoot%\SysWOW64\config\systemprofile\Desktop

When using 64-bit version of Microsoft Excel, you need to create the following folder in

advance.

%SystemRoot%\System32\config\systemprofile\Desktop

%SystemRoot% mentioned above specifies the same folder as the environment variable

"SystemRoot".

Use situation

If you are using a CSV or Excel split part to split an Excel file, and you want to change the operation to use a CSV data split part, you must convert the Excel file as a CSV file. It is possible to convert the file by this part.

Prerequisites

For the most recent information about the prerequisite products on the execution-target server, and supported OSs for the execution-target server, see the Release Notes.

In addition, the following OS and products use abbreviations. For the abbreviations of OS and products, see the "Preface".

Prerequisite products on the execution-target server:

(1) Microsoft Excel

Supported OSs for the execution-target server:

(1) Windows Server

Conditions for using the prerequisite products on the execution-target server:

None.

Cautions

(1) Do not specify character strings containing double quotation marks (") or single quotation

marks (') for properties of this plug-in.

(2) If this plug-in terminated abnormally and "80080005 Server execution failed" was output

in the task log, the Excel file might be open on the execution-target server. Confirm

the status of the Excel file. At this time, the process "OfficeC2RClient.exe" might start

up. If you want to terminate this process, operate with Task Manager, etc.

(3) If the file names before the conversion or the file names after conversion are the same,

do not execute this plug-in at the same time.

(4) Microsoft Excel is used to read or output a file. For this reason, the limitations on

the number of columns and rows in a file that can be read and the format of the output

CSV are limited to the version or edition of Microsoft Excel that you use.

Note that CSV files in UTF-8 cannot be output for versions earlier than Microsoft Excel

2019; therefore, do not specify UTF-8 for the character encoding type

(common.characterEncoding property). Also, if UTF-8 is specified in the versions of

Microsoft Excel 2019, Microsoft Excel sets BOM (Byte Order Mark) in the CSV file.

(5) Hidden files cannot be specified for the properties of this plug-in.

(6) If you execute this plug-in multiple times on the same execution-target server, exclusive

processing causes processing waits. The waiting process will time out after 3600 seconds

and the execution will fail.

Execution privilege

Administrator permission

Version

03.60.01

Plug-in tags

Control OS,File Operations,Windows

Plug-in name displayed in the task log

osConvertExcelFile

Return code

0: Normal

12: Error (mistake by user) Invalid property

21: Error (invalid environment) Command cannot be found (error detected in the plug-in script)

27: Error (check task logs for the nature of error)

Property list

The following table lists the properties:

Property key

Property name

Description

Default value

I/O type

Required

plugin.destinationHost

Host name of the execution target server

Specify the host name or IP address of the server on which this plugin will be executed. IPv6 addresses are not supported.

--

Input

R

common.fileName

File name

Specify the full path of the target Excel file to be converted. You can specify a wildcard (*) in the file name.

--

Input

R

common.sheetName

Worksheet name in Excel file

Specify the name of the worksheet in the Excel file.

Sheet1

Input

O

common.outputFolderPath

Destination folder path for file output

Specify the full path of the folder to which to output the output files.

--

Input

R

common.characterEncoding

Character encoding

Specify the encoding of the CSV file. You can specify DEFAULT or UTF-8.

DEFAULT

Input

O

common.returnValue

Return value for the plugin

The return value of this plugin stored.

--

Output

O