Tutorial: Creating xls2csv Streaming Task
Overview
xls2csv task is designed to convert xls, xlsm or xlsx files to csv files within IWS solutions.
xls2csv conversion consists of two elements: Java executable jar file (which performs actual translation) and streaming task adapter (which provides an interface to interact with jar file and set execution parameters).
Java executable jar file works with Java 6 and newer.
On this page
Deployment
xls2csv is provided for deployment as workflow MC package which can be installed through Message Center Editor and contains the task itself and the jar file which performs actual translation.
To deploy xls2csv solution on the box:
Ā Ā Ā 1. Open MCE andĀ go to Message Center Streams tab
Ā Ā Ā 2. Right-clickĀ Message Center Streams tab
Ā Ā Ā 3. And choose Import Stream option
Ā Ā 4. Choose xls2csv_dplmt_wrf_main.pkg file in xls2csv_dplmnt_wrf.zip folder you want to import. ClickĀ Next. Agree to rewrite existing files. Dismiss the Warning pop-up.
Ā Ā 5. Press Next twice, wait for data upload to finish and press Create Streams button.
Using Adapter Task
To add a xls2csv adapter to your solution, please follow these steps:
Drag and drop translator activity on your solution canvas:
Double-click new translator task and choose Existing to make your search faster ā use search window in the upper right corner of the tab.
Add a proper data artifact (if itās external of inner data artifact of solution) and create a connection to xls2csv adapter. The task will use incoming file as a source for translation and provide result file(s) as its outgoing tasks.
Set launch options if necessary (see Launch OptionsĀ below)
Note: Do not make or save any changes in xls2csv task
Note: You are free to rename task in your solution after creation if needed. Source of the task must be unchanged
Launch Options
Using translation launch options the user can modify the way converter performs file translation. Set CustomCMParams in task properties to specify translation properties.
By default outgoing file name will contain source file name without extension in the beginning, outgoing file will contain data from all sheets of the source file merged one after another from 1st sheet to last, outgoing file will have comma as a delimiter
The following launch options are available (options are case sensitive!):
delimiter
Allows to set delimiter that will be used in result file.
Note: Due to symbol restrictions the user must use commaĀ parameter value to explicitly set comma (ā,ā) as a delimiter in the outgoing file, pipeĀ to set pipe (ā|ā) delimiter orĀ tabĀ to set tabulation (ā\tā) delimiter. Other delimiter options do not have any special translation, feel free to use them as they are meant to be, but please avoid using special characters in workflow syntax.
encoding
Allows to set encoding to be used in result file(s).
dateFormat
Allows to set specific date format. Date format is MM/dd/yyyy by default.
Converter processes date format by Java rules so MM stands for months, dd ā for days, yyyy ā for years (mm stands for minutes, DD ā days from the beginning of the year and YYYY ā week year). But task adapter performs pre-conversion before passing parameters to jar converter so even if the user enters mm-dd-yyyy or YYYYMMDD, it will be converted to proper MM-dd-yyyy and yyyyMMdd correspondingly.
filenameToken
Allows to set the token that will be used in the result file name.
mergeSheets
Allows to switch off sheets merge or explicitly specify that sheets must be merged in one file (sheets are merged by default). Use āYā or ātrueā in any case to explicitly enable merge, use any other value to switch merge off.
Note: If merge is disabled, every sheet will be translated to a separate file with token in its name. In case option sheetsByName or no sheetsBy was chosen, sheet name will be used as token. In case option sheetsByNumber is enabled, sheet number will be used as token.
password
Allows to set password which is used to access protected source files. To translate ā!ā symbol please use āu+0021ā
saveSourceName
saveSourceName by default is enabled, set to "N" to switch off.
sheetsByName
Allows to choose which sheet(s) from source must be processed. For multiple sheet names use ā?ā delimiter as follows Sheet1?Sheet2?Sheet3.
If the sheet name contains special characters and mergeSheets option is off, consider using option sheetsByNumber to avoid any issues with creating result file with sheet name token (some special characters are allowed in sheet name but can not be used as part of file name).
Note: If sheet name is specified but sheet with such name is not present in the source file, no exception will be thrown.
sheetsByNumber
Allows to choose which sheet(s) from source must be processed. For multiple sheet use comma delimiter as follows 2,3,5. Sheets numeration starts from 1. Note that if sheet number is specified, but there is no such sheet number present in the source file ā no exception will be thrown.
newLineInCell
Allows to set character(s) that will be used as replacement for new line and carriage return if they are present in cell data.
Ā ā~ā is default replacement.
Use ānoneā if new line and carriage return must be removed completely.