How to process both xls (2003) and xlsx (higher 2007) with same input

One Star

How to process both xls (2003) and xlsx (higher 2007) with same input

Hi,
is there any way that i can process both the excel (xls and xlsx) using tFileInputExcel
Note : i checked the option (Read excel2007 file format) it just process only xlsx file not xls files
the code that generated by talend when i check this option it uses org.apache.poi.xssf.usermodel.XSSFWorkbook to read the file
if not checked then it uses java.io.BufferedInputStream to read file.
I appreciate if any once can send a solution that process both (xls and xlsx) at same time.
Thanks
Community Manager

Re: How to process both xls (2003) and xlsx (higher 2007) with same input

Hello
Using tFileList to list each file and get the file properties, if the file extension is xls, read the file using tFileInputExcel with unchecking the option, if the file extension is xlsx, read the file using another tFileInputExcel with checking the option. eg:
tFileList---iterate---tJava---runIf---tFileInputExcel_1...
---runIf---tFileInputExcel_2...
tJava: get the file name, parse the file extension, set the extension to global variable, eg: globalMap.put("extension","xls")
runIf: set the condition like: (String)globalMap.get("extension").equals("xls")
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to process both xls (2003) and xlsx (higher 2007) with same input

Thanks shong...........I appreciate your time.