<?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: Check whether a sheet in excel exists before loading it in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Check-whether-a-sheet-in-excel-exists-before-loading-it/m-p/655909#M670120</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can loop on all sheet of an excel and check if exists (in the above script, Sheet2) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ODBC CONNECT32 To [Excel Files;DBQ=C:\Users\mgrossi\Downloads\Book1.xls];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sheets:&lt;/P&gt;&lt;P&gt;SQLTABLES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;let var = NoOfRows('Sheets');&lt;/P&gt;&lt;P&gt;FOR i = 0 to $(var)-1&lt;/P&gt;&lt;P&gt;&amp;nbsp; let sheetName=subfield(peek('TABLE_NAME', i,'Sheets'),'$',1);&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if '$(sheetName)'='Sheet2' then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trace $(sheetName) exists;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if;&lt;/P&gt;&lt;P&gt;next;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 21 Sep 2014 15:29:20 GMT</pubDate>
    <dc:creator>maxgro</dc:creator>
    <dc:date>2014-09-21T15:29:20Z</dc:date>
    <item>
      <title>Check whether a sheet in excel exists before loading it</title>
      <link>https://community.qlik.com/t5/QlikView/Check-whether-a-sheet-in-excel-exists-before-loading-it/m-p/655906#M670117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to check if a certain sheet exists in an excel file before I load it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Boris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Sep 2014 13:52:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-whether-a-sheet-in-excel-exists-before-loading-it/m-p/655906#M670117</guid>
      <dc:creator />
      <dc:date>2014-09-21T13:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether a sheet in excel exists before loading it</title>
      <link>https://community.qlik.com/t5/QlikView/Check-whether-a-sheet-in-excel-exists-before-loading-it/m-p/655907#M670118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can check by trying to load it and see what error is returned, if any;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set ErrorMode = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load * from file;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ScriptError=8&amp;nbsp; // this is file not found error&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;exit script;&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get below list of error mode from the help doc or reference manual&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE cellspacing="0" class="TableStyle-LeftBold"&gt;&lt;TBODY&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;0&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;No error&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;1&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;General error&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;2&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;Syntax error&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;3&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;General ODBC error&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;4&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;General OLE DB error&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;5&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;General custom database error&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;6&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;General XML error&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;7&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;General HTML error&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;8&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;File not found&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;9&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;Database not found&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;10&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;Table not found&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;11&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;Field not found&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;12&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;File has wrong format&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;13&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;BIFF error&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;14&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;BIFF error encrypted&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;15&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;BIFF error unsupported version&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;16&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;Semantic error&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kalpesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Sep 2014 14:28:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-whether-a-sheet-in-excel-exists-before-loading-it/m-p/655907#M670118</guid>
      <dc:creator />
      <dc:date>2014-09-21T14:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether a sheet in excel exists before loading it</title>
      <link>https://community.qlik.com/t5/QlikView/Check-whether-a-sheet-in-excel-exists-before-loading-it/m-p/655908#M670119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the following script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If Not(IsNull('your excel file name')) Then&lt;/P&gt;&lt;P&gt;(Your load statements here)&lt;/P&gt;&lt;P&gt;EnfIf&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Sep 2014 14:40:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-whether-a-sheet-in-excel-exists-before-loading-it/m-p/655908#M670119</guid>
      <dc:creator>nagaiank</dc:creator>
      <dc:date>2014-09-21T14:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether a sheet in excel exists before loading it</title>
      <link>https://community.qlik.com/t5/QlikView/Check-whether-a-sheet-in-excel-exists-before-loading-it/m-p/655909#M670120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can loop on all sheet of an excel and check if exists (in the above script, Sheet2) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ODBC CONNECT32 To [Excel Files;DBQ=C:\Users\mgrossi\Downloads\Book1.xls];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sheets:&lt;/P&gt;&lt;P&gt;SQLTABLES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;let var = NoOfRows('Sheets');&lt;/P&gt;&lt;P&gt;FOR i = 0 to $(var)-1&lt;/P&gt;&lt;P&gt;&amp;nbsp; let sheetName=subfield(peek('TABLE_NAME', i,'Sheets'),'$',1);&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if '$(sheetName)'='Sheet2' then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trace $(sheetName) exists;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if;&lt;/P&gt;&lt;P&gt;next;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Sep 2014 15:29:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-whether-a-sheet-in-excel-exists-before-loading-it/m-p/655909#M670120</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-09-21T15:29:20Z</dc:date>
    </item>
  </channel>
</rss>

