<?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 Loop Excel sheets with IF statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loop-Excel-sheets-with-IF-statement/m-p/878291#M1018664</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following script which loops through each sheet in an Excel workbook and loads into QlikView. I now wish to limit the sheets loaded based on the TABLE_NAME field (from SQLTABLES). For example, where TABLE_NAME is not like '*Print_Area' (or in other words where TABLE_NAME does not have a suffix of "&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Print_Area"&lt;/SPAN&gt;). I'm assuming that an if/else statement before or after the loop could be used but I'm not sure of the syntax etc. Any help would be greatly appreciated. Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ODBC CONNECT32 TO [Excel Files;DBQ=&amp;lt;path&amp;gt;.xlsx];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET vFile = '&amp;lt;path&amp;gt;.xlsx';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ExcelSheetNames:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SQLTABLES;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;DISCONNECT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR i = 0 to NoOfRows('ExcelSheetNames')-1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vExcelSheets = PURGECHAR(PURGECHAR(PEEK('TABLE_NAME', i,'ExcelSheetNames'), CHR(39)), CHR(36));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LOAD *,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; '$(vExcelSheets)' AS Sheet&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; FROM $(vFile)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; (ooxml, no labels, table is&amp;nbsp; [$(vExcelSheets)]);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NEXT&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Apr 2015 16:04:38 GMT</pubDate>
    <dc:creator>kmarsden</dc:creator>
    <dc:date>2015-04-08T16:04:38Z</dc:date>
    <item>
      <title>Loop Excel sheets with IF statement</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-Excel-sheets-with-IF-statement/m-p/878291#M1018664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following script which loops through each sheet in an Excel workbook and loads into QlikView. I now wish to limit the sheets loaded based on the TABLE_NAME field (from SQLTABLES). For example, where TABLE_NAME is not like '*Print_Area' (or in other words where TABLE_NAME does not have a suffix of "&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Print_Area"&lt;/SPAN&gt;). I'm assuming that an if/else statement before or after the loop could be used but I'm not sure of the syntax etc. Any help would be greatly appreciated. Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ODBC CONNECT32 TO [Excel Files;DBQ=&amp;lt;path&amp;gt;.xlsx];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET vFile = '&amp;lt;path&amp;gt;.xlsx';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ExcelSheetNames:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SQLTABLES;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;DISCONNECT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR i = 0 to NoOfRows('ExcelSheetNames')-1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vExcelSheets = PURGECHAR(PURGECHAR(PEEK('TABLE_NAME', i,'ExcelSheetNames'), CHR(39)), CHR(36));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LOAD *,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; '$(vExcelSheets)' AS Sheet&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; FROM $(vFile)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; (ooxml, no labels, table is&amp;nbsp; [$(vExcelSheets)]);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NEXT&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2015 16:04:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-Excel-sheets-with-IF-statement/m-p/878291#M1018664</guid>
      <dc:creator>kmarsden</dc:creator>
      <dc:date>2015-04-08T16:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Excel sheets with IF statement</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-Excel-sheets-with-IF-statement/m-p/878292#M1018666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would probably put an If-statement inside the loop:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For i = 0 ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let vExcelSheets = ... ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Index( vExcelSheets , 'Print_Area' ) = 0 Then // does not contain Print_Area&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End IF&lt;/P&gt;&lt;P&gt;Next i&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2015 16:17:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-Excel-sheets-with-IF-statement/m-p/878292#M1018666</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2015-04-08T16:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Excel sheets with IF statement</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-Excel-sheets-with-IF-statement/m-p/878293#M1018668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great! Exactly what I was looking for. Thanks for your help&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; Henric&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2015 09:11:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-Excel-sheets-with-IF-statement/m-p/878293#M1018668</guid>
      <dc:creator>kmarsden</dc:creator>
      <dc:date>2015-04-09T09:11:55Z</dc:date>
    </item>
  </channel>
</rss>

