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

Highlighted
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.

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads