Five Stars

Get exccel Sheet Names

Hello, I have an excel and i whant to verify that the 2 sheets exist.

 

How can i do that? i tried with Tmap and ((String)globalMap.get("tFileInputExcel_1_CURRENT_SHEET")) but i get multipe times the sheet names. See pic.

1 ACCEPTED SOLUTION

Accepted Solutions
Twelve Stars TRF
Twelve Stars

Re: Get exccel Sheet Names

Hi,

As far as I know there is no shortcut for this purpose.

However, you can select "All sheets" on configuration tab, then connect tFileInputExcel to a tJava and set a global variable for each sheet (but remember the Excel must be read for that) using the following Java code:

globalMap.put((String)globalMap.get("tFileInputExcel_1_CURRENT_SHEET"), "");

After tJava, if you're expecting for 2 sheets named sheet1 and sheet2, you can use an If trigger to connect the next component with this condition: 

(String)globalMap.get("sheet1") != null && (String)globalMap.get("sheet2") != null

As soon as sheet1 and sheet are defined in the Excel file and are not empty, the condition is true and je job continue with the next component.

Hope this helps.


TRF
2 REPLIES
Twelve Stars TRF
Twelve Stars

Re: Get exccel Sheet Names

Hi,

As far as I know there is no shortcut for this purpose.

However, you can select "All sheets" on configuration tab, then connect tFileInputExcel to a tJava and set a global variable for each sheet (but remember the Excel must be read for that) using the following Java code:

globalMap.put((String)globalMap.get("tFileInputExcel_1_CURRENT_SHEET"), "");

After tJava, if you're expecting for 2 sheets named sheet1 and sheet2, you can use an If trigger to connect the next component with this condition: 

(String)globalMap.get("sheet1") != null && (String)globalMap.get("sheet2") != null

As soon as sheet1 and sheet are defined in the Excel file and are not empty, the condition is true and je job continue with the next component.

Hope this helps.


TRF
Six Stars

Re: Get exccel Sheet Names

 hello

use taggregate after your tmap