Hi, I have an excel file with multiple sheets, I don't know each time how many sheets there will be in the file. How can I iterate the same talend elaboration on each sheet. I would like to have an output file for each sheet of the excel file. Thanks in advance for your precious help.
Hi This should help.
To get each Sheet in an Excell File...
Use a tJavaFlex with a file name as input and send its output to tfileinputExcel
For example tFileList---(fileName)-->tJavaFlex---(Iterate Through SheetName) --->tFileInputExcel
In the tJava Flex the Start Code should be :
final jxl.WorkbookSettings WBS_1 = new jxl.WorkbookSettings();
WBS_1.setEncoding("ISO-8859-15");
final
jxl.Workbook WB_1 = jxl.Workbook.getWorkbook(
new java.io.BufferedInputStream(new java.io.FileInputStream(
(((String)globalMap.get("rejects.FilePath"))))),
WBS_1);
java.lang.String[] sheetNames = WB_1.getSheetNames();
for (int ixx=0; ixx< sheetNames.length; ixx++) {
String theSheet = sheetNames;
// I don't want this one its crap
if ("DSAFO32ADVVERINF32".equals(theSheet)) continue;
globalMap.put("CURRENT_SHEET", theSheet);
The Main Code Should Be:
Nothing... Put a comment in here...
The End Code Should Be :
)
Thats it.
Then take an iterate flow out of this and it will iterate for each one of the sheets in your file.
The receiver of the iterate could be an Excel input. where you can use globalMap.get("CURRENT_SHEET");
as the sheet name.
This works.
have fun.
Aamer
hi is it possible to set the automatic time to run this job.. suppose dialy evening 5 o clock the job should run automatically and the excel valuse should store into database