Skip to main content
Okay..I'm finally getting some time to work on this. I can do this using python and using the *.py  as a startup script in the workbench but I was wondering if I can do this using only transformers.

 

 

1) Directory full of excel files...with filename separated by an unscore  ie A_B_C.xls

 

 

2) Load the file listing into a table as such

 

 

Column 1: A_B_C.xls

 

Column 2: A

 

Column 3: B

 

Column 4 C

 

 

Hi,

 

 

The Directory and File Pathnames Reader, the AttributeSplitter and the AttributeRenamer can do that.

 

  1) Add a Directory and File Pathnames Reader. Dataset: <directory in which the *.xls files are saved> Path Filter: *.xls This reader extracts several attributes named "path_***" for every file saved in the specified directory. In this case, you can use "path_filename" (file name, e.g. "A_B_C.xls") and "path_rootname" (file name without extension, e.g. "A_B_C").

 

If you want to select only files whose name is strictly formatted in "*_*_*.xls", specify "*_*_*.xls" to the Path Filter.   2) Add an AttributeSplitter to split "path_rootname" at underscore. Attribute to Split: path_rootname Delimiter or Format String: _ (under score) List Name: _list (for example)   3) Add an SttributeRenamer to rename the required attributes. Old Attribute  |  New Attribute path_filename  |  Column 1 _list{0}  |  Column 2 _list{1}  |  Column 3 _list{2}  |  Column 4

 

Takashi
... correction for a typo:

 

3) Add an AttributeRenamer to rename the required attributes.
Thx Takashi.

 

 

I'll give it a try!

 

 

ken

 


Reply