<?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: loop thru excel worksheet with specific name in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/loop-thru-excel-worksheet-with-specific-name/m-p/578357#M215031</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you say there are many examples of looping through Excel sheets.&amp;nbsp; You just need to find one that works for you and add two lines, to skip non 'mod' ones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if lower(right(vTabName))&lt;/STRONG&gt;&lt;STRONG&gt; = 'mod' then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [... load sheet ...]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;end if&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Personally when I am loading from multiple tabs I prefer to add a metadata tab to the start of the spreadsheet listing the names of all tabs that should be loaded.&amp;nbsp; This can then be enumerated around with a PEEK statement.&amp;nbsp; This means if someone adds a random sheet it doesn't get pulled in by mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A step I would add to Felipe's code is after retrieving &lt;STRONG&gt;File&lt;/STRONG&gt; check for the &lt;STRONG&gt;~ &lt;/STRONG&gt;character.&amp;nbsp; This is a system file created when a user has a spreadsheet open, and this can be picked up by a &lt;STRONG&gt;*.xls&lt;/STRONG&gt;.&amp;nbsp; Simply add this check after retrieving each file name:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if index(FILE, '~') = 0 then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will then skip any files that are system generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Mar 2014 07:22:42 GMT</pubDate>
    <dc:creator>stevedark</dc:creator>
    <dc:date>2014-03-15T07:22:42Z</dc:date>
    <item>
      <title>loop thru excel worksheet with specific name</title>
      <link>https://community.qlik.com/t5/QlikView/loop-thru-excel-worksheet-with-specific-name/m-p/578354#M215028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am finding lot of threads that shows how to loop thru all worksheets in a workbook. However If i have a workbook with 15 sheets but I only want to loop thru all the sheets whose name end in *mod. how can I do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please share example. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2014 02:14:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/loop-thru-excel-worksheet-with-specific-name/m-p/578354#M215028</guid>
      <dc:creator>userid128223</dc:creator>
      <dc:date>2014-03-15T02:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: loop thru excel worksheet with specific name</title>
      <link>https://community.qlik.com/t5/QlikView/loop-thru-excel-worksheet-with-specific-name/m-p/578355#M215029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set vPath = C:\Test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR Each File in FileList('$(vPath)\*.xls')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ODBC CONNECT32 TO [Excel Files;DBQ=$(File)];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TabTmp:&lt;/P&gt;&lt;P&gt;&amp;nbsp; SQLTABLES;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Tab:&lt;/P&gt;&lt;P&gt;&amp;nbsp; LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp; RowNo() as Line,&lt;/P&gt;&lt;P&gt;&amp;nbsp; TABLE_CAT as X,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If(Right(TABLE_CAT, 3) like 'xls', TABLE_NAME, If(Right(TABLE_NAME, 1) like '$', Left(TABLE_NAME, Len(TABLE_NAME)-1), TABLE_NAME)) as Y,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If(Right(TABLE_CAT, 3) like 'xls', 'biff', 'ooxml') as Z &lt;/P&gt;&lt;P&gt;&amp;nbsp; Resident TabTmp&lt;/P&gt;&lt;P&gt;&amp;nbsp; Where Right(PurgeChar(TABLE_NAME, '$'), 3) like 'mod'; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DROP Table TabTmp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT File&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For vLine = 0 to Peek('Line', -1, 'Tab')-1 step 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; vX = Peek('X', $(vLine), 'Tab');&lt;/P&gt;&lt;P&gt;&amp;nbsp; vY = Peek('Y', $(vLine), 'Tab');&lt;/P&gt;&lt;P&gt;&amp;nbsp; vZ = '('&amp;amp;Peek('Z', $(vLine), 'Tab')&amp;amp;', embedded labels, table is $(vY))';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; [$(vY)]:&lt;/P&gt;&lt;P&gt;&amp;nbsp; LOAD *&lt;/P&gt;&lt;P&gt;&amp;nbsp; FROM&lt;/P&gt;&lt;P&gt;&amp;nbsp; [$(vX)]&lt;/P&gt;&lt;P&gt;&amp;nbsp; $(vZ);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT vLine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Table Tab;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2014 06:15:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/loop-thru-excel-worksheet-with-specific-name/m-p/578355#M215029</guid>
      <dc:creator>felipe_dutra</dc:creator>
      <dc:date>2014-03-15T06:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: loop thru excel worksheet with specific name</title>
      <link>https://community.qlik.com/t5/QlikView/loop-thru-excel-worksheet-with-specific-name/m-p/578356#M215030</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;Check this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/message/195769"&gt;How to read the data from multiple sheets of an excel file?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/message/209459"&gt;How to load excel excluding one sheet?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/message/95909"&gt;Excel with multiple sheets&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/message/223618"&gt;Loading from multiple Excel files and multiple sheets&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2014 07:02:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/loop-thru-excel-worksheet-with-specific-name/m-p/578356#M215030</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2014-03-15T07:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: loop thru excel worksheet with specific name</title>
      <link>https://community.qlik.com/t5/QlikView/loop-thru-excel-worksheet-with-specific-name/m-p/578357#M215031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you say there are many examples of looping through Excel sheets.&amp;nbsp; You just need to find one that works for you and add two lines, to skip non 'mod' ones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if lower(right(vTabName))&lt;/STRONG&gt;&lt;STRONG&gt; = 'mod' then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [... load sheet ...]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;end if&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Personally when I am loading from multiple tabs I prefer to add a metadata tab to the start of the spreadsheet listing the names of all tabs that should be loaded.&amp;nbsp; This can then be enumerated around with a PEEK statement.&amp;nbsp; This means if someone adds a random sheet it doesn't get pulled in by mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A step I would add to Felipe's code is after retrieving &lt;STRONG&gt;File&lt;/STRONG&gt; check for the &lt;STRONG&gt;~ &lt;/STRONG&gt;character.&amp;nbsp; This is a system file created when a user has a spreadsheet open, and this can be picked up by a &lt;STRONG&gt;*.xls&lt;/STRONG&gt;.&amp;nbsp; Simply add this check after retrieving each file name:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if index(FILE, '~') = 0 then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will then skip any files that are system generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2014 07:22:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/loop-thru-excel-worksheet-with-specific-name/m-p/578357#M215031</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2014-03-15T07:22:42Z</dc:date>
    </item>
  </channel>
</rss>

