<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to catch error in tFileInputExcel in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353858#M119960</link>
    <description>when i try to read the excel file following error is coming :-&lt;BR /&gt; Exception in component tFileInputExcel_2&lt;BR /&gt; java.lang.RuntimeException: Special sheets not exist!</description>
    <pubDate>Thu, 16 Jan 2014 08:47:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-01-16T08:47:40Z</dc:date>
    <item>
      <title>how to catch error in tFileInputExcel</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353851#M119953</link>
      <description>Hello,&lt;BR /&gt;I want to implement a tFileList that iterates on multiple Excel files.&lt;BR /&gt;When one of the Excel files does not match with expected format (for exemple, the sheet name is not the expected one), I would like to log the error and to be able to continue the process on the other excel files.&lt;BR /&gt;For that, I try to use onComponentError but it does not work as I expected.&lt;BR /&gt;In fact, the tFileInputExcel stops with following error trace :&lt;BR /&gt;       Exception in component tFileInputExcel_1  java.lang.RuntimeException: Special sheets not exist!&lt;BR /&gt;What is the best way to manage that ?</description>
      <pubDate>Sat, 16 Nov 2024 13:42:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353851#M119953</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2024-11-16T13:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to catch error in tFileInputExcel</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353852#M119954</link>
      <description>Hello,&lt;BR /&gt;The only way would be to insert a tJava before the tFileInputExcel and coding this test using JExcel API : &lt;A href="http://jexcelapi.sourceforge.net/" rel="nofollow noopener noreferrer"&gt;http://jexcelapi.sourceforge.net/&lt;/A&gt;</description>
      <pubDate>Thu, 05 Nov 2009 09:41:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353852#M119954</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-05T09:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to catch error in tFileInputExcel</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353853#M119955</link>
      <description>Thank you for this suggestion. But this means that I have to implement all possible error cases : bad sheet name, bad column names... ?&lt;BR /&gt;I was expecting that the tFileInputExcel does this job and that it was possible to catch something in case of problem. &lt;BR /&gt;So what is really the usage of onComponentError ?</description>
      <pubDate>Thu, 05 Nov 2009 09:56:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353853#M119955</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2009-11-05T09:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to catch error in tFileInputExcel</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353854#M119956</link>
      <description>For testing sheet name, it's not that hard:&lt;BR /&gt;U could do something like this :&lt;BR /&gt;&lt;PRE&gt;import java.io.File; &lt;BR /&gt;import java.io.File; &lt;BR /&gt;import jxl.*; &lt;BR /&gt;//use context variable to easily integrate a test in Talend&lt;BR /&gt;context.fileHasRequiredSheet = false;&lt;BR /&gt;String requiredSheetName="Special";&lt;BR /&gt;Workbook workbook = Workbook.getWorkbook(new File("myfile.xls"));&lt;BR /&gt;String[] sheetNames = workbook.getSheetNames();&lt;BR /&gt;for(int i=0;i&amp;lt;sheetNames.length;i++)&lt;BR /&gt;{&lt;BR /&gt;  if(sheetNames&lt;I&gt;.equals(requiredSheetName))&lt;BR /&gt;  {&lt;BR /&gt;     context.fileHasRequiredSheet = true;&lt;BR /&gt;     break;&lt;BR /&gt;  }&lt;BR /&gt;}&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;I don't think u could have error in column names, Excel doesn't have any concept of schema, so Talend or any software can't implement such logic.</description>
      <pubDate>Thu, 05 Nov 2009 10:11:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353854#M119956</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-05T10:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to catch error in tFileInputExcel</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353855#M119957</link>
      <description>hi all, 
&lt;BR /&gt;I 've also have to manage with a lot of excel files and sheet name never what it expected to be 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;In the same way as 'Morbo' as use jxl.* read some information and loop all excel sheets . 
&lt;BR /&gt; 
&lt;PRE&gt;	public static String[] getExcelSheetList(String path){&lt;BR /&gt;		String[]sheetsName = null;&lt;BR /&gt;		try{&lt;BR /&gt;			//System.out.println(path.split("."));&lt;BR /&gt;		if(path.substring(path.indexOf(".")+1, path.length()).equalsIgnoreCase("xls")){&lt;BR /&gt;			/** &lt;BR /&gt;			 * on recupere la liste des noms des feuilles&lt;BR /&gt;			 */&lt;BR /&gt;			int nbrXls = 0;&lt;BR /&gt;			&lt;BR /&gt;			//Sheet sheet = null;&lt;BR /&gt;			Workbook workbook = Workbook.getWorkbook(new File(path)); &lt;BR /&gt;			for(int i = 0; i &amp;lt; workbook.getNumberOfSheets(); i++){&lt;BR /&gt;				nbrXls += workbook.getSheet(i).getRows();&lt;BR /&gt;			}&lt;BR /&gt;			&lt;BR /&gt;			// liste des noms de feuilles&lt;BR /&gt;			sheetsName = workbook.getSheetNames();&lt;BR /&gt;			for(int j = 0; j &amp;lt; sheetsName.length; j++)&lt;BR /&gt;				System.out.println(sheetsName&amp;lt;J&amp;gt;);&lt;BR /&gt;		}&lt;BR /&gt;		}&lt;BR /&gt;		catch(ArrayIndexOutOfBoundsException e){e.printStackTrace();} catch (JXLException e) {&lt;BR /&gt;			// TODO Auto-generated catch block&lt;BR /&gt;			e.printStackTrace();&lt;BR /&gt;		} catch (IOException e) {&lt;BR /&gt;			// TODO Auto-generated catch block&lt;BR /&gt;			e.printStackTrace();&lt;BR /&gt;		}&lt;BR /&gt;		&lt;BR /&gt;		return sheetsName;&lt;BR /&gt;	}&amp;lt;/J&amp;gt;&lt;/PRE&gt; 
&lt;BR /&gt;there you can catch error and make something when it occured.(use Morbo's context variable tip and use a boolean 'flag' for example. 
&lt;BR /&gt;ps : in my example I use very helpfull exchange Component tFileChooser 
&lt;BR /&gt;hope it could help you 
&lt;BR /&gt;laurent</description>
      <pubDate>Thu, 05 Nov 2009 11:08:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353855#M119957</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-05T11:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to catch error in tFileInputExcel</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353856#M119958</link>
      <description>Thank for your propositions. As I would like to not introduce specific javacode, I will in fact now work with an XML export of the excel files that will offer better control in our case.
&lt;BR /&gt;On the other hand, note that I had a look in the source of tFileInputExcel and in particular in tFileInputErrorExcel_begin.javajet file. 
&lt;BR /&gt;I contains the following line that raises the previous error trace that I have mentionned :
&lt;BR /&gt; if(sheetList_&amp;lt;%= cid %&amp;gt;.size() &amp;lt;= 0){
&lt;BR /&gt; throw new RuntimeException("Special sheets not exist!");
&lt;BR /&gt; }
&lt;BR /&gt;I'm convinced that it is possible to not throw an error here but only if the existing variable dieOnError is true. 
&lt;BR /&gt;This could be a good enhancement for tFileInputExcel.</description>
      <pubDate>Thu, 05 Nov 2009 14:57:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353856#M119958</guid>
      <dc:creator>joreun</dc:creator>
      <dc:date>2009-11-05T14:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to catch error in tFileInputExcel</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353857#M119959</link>
      <description>If u get rid of the exception throwing, U'll have to handle some other way (adding if conditions) the case when the sheet doesn't exist to stop further processing of the component. 
&lt;BR /&gt;Another way would be to englobe the processing of the component by a "try" block catching this execption and ouputing a warning. 
&lt;BR /&gt;Feel free to modify yourself the tFileInputExcel, U can post your enhancement to the bugtracker. 
&lt;BR /&gt;I've done it myself in the past, Talend integrated my changes after some times.</description>
      <pubDate>Thu, 05 Nov 2009 15:27:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353857#M119959</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-05T15:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to catch error in tFileInputExcel</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353858#M119960</link>
      <description>when i try to read the excel file following error is coming :-&lt;BR /&gt; Exception in component tFileInputExcel_2&lt;BR /&gt; java.lang.RuntimeException: Special sheets not exist!</description>
      <pubDate>Thu, 16 Jan 2014 08:47:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353858#M119960</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T08:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to catch error in tFileInputExcel</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353859#M119961</link>
      <description>Hi pgandhi, 
&lt;BR /&gt;Would you mind opening a new topic for your issue? In addition, please give us more info about your current situation(what talend product build version are you using, how did you set your tFileInputExcel component).
&lt;BR /&gt;Best regards
&lt;BR /&gt;Sabrina</description>
      <pubDate>Thu, 16 Jan 2014 08:57:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-catch-error-in-tFileInputExcel/m-p/2353859#M119961</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T08:57:43Z</dc:date>
    </item>
  </channel>
</rss>

