<?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: Loading multiple excel sheets containing different data in one go using for loop in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loading-multiple-excel-sheets-containing-different-data-in-one/m-p/47377#M784768</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Atiya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The below script consolidate all excel files and sheets into singe table. If you have any issues with the below code, I would suggest you to attach sample excel files and post expected output. Good luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15203098339444926" jivemacro_uid="_15203098339444926"&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;Load '' as DummyField AutoGenerate 0;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;FOR EACH file in FileList('C:\Users\Tamil\Desktop\*.xlsx');&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ODBC CONNECT32 TO [Excel Files;DBQ=$(file)];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Temp:&lt;/P&gt;
&lt;P&gt;SQLtables;&lt;/P&gt;
&lt;P&gt;DISCONNECT;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;FOR i = 0 to NoOfRows('Temp')-1&lt;/P&gt;
&lt;P&gt;LET vSheetName = PurgeChar(Peek('TABLE_NAME', i, 'Temp'), chr(36));&lt;/P&gt;
&lt;P&gt;LET vSheetName = Replace(vSheetName,chr(39) &amp;amp; chr(39),chr(39));&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Concatenate (Data)&lt;/P&gt;
&lt;P&gt;Table:&lt;/P&gt;
&lt;P&gt;Load * ,&lt;/P&gt;
&lt;P&gt;FileBaseName()&amp;nbsp;&amp;nbsp; as File&lt;SPAN style="font-size: 9pt;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;FileName()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as File_Name,&lt;/P&gt;
&lt;P&gt;'$(vSheetName)'&amp;nbsp; as Sheet_name&lt;/P&gt;
&lt;P&gt;From $(file)(ooxml, embedded labels, table is [$(vSheetName)]);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NEXT i&lt;/P&gt;
&lt;P&gt;Drop table Temp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Next&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DROP Field DummyField;&lt;/P&gt;


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Mar 2018 04:20:02 GMT</pubDate>
    <dc:creator>tamilarasu</dc:creator>
    <dc:date>2018-03-06T04:20:02Z</dc:date>
    <item>
      <title>Loading multiple excel sheets containing different data in one go using for loop</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-multiple-excel-sheets-containing-different-data-in-one/m-p/47375#M784765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial, Helvetica, sans-serif; font-size: 15px; background-color: #fdfdfd;"&gt;I have an excel workbook with 20 worksheets. Each worksheet has a different name (i.e. Product,customer,sales, etc.) All the worksheets are in the different format and contain the different fields. How do I create a loop to load all worksheets in the excel workbook in Qlikview?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial, Helvetica, sans-serif; font-size: 15px; background-color: #fdfdfd;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial, Helvetica, sans-serif; font-size: 15px; background-color: #fdfdfd;"&gt;I don't want to load sheet one by one manually.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-multiple-excel-sheets-containing-different-data-in-one/m-p/47375#M784765</guid>
      <dc:creator>atiyaharem</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Loading multiple excel sheets containing different data in one go using for loop</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-multiple-excel-sheets-containing-different-data-in-one/m-p/47376#M784767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please someone help, looking for an answer for long, but i am getting solution for the scenarion when the sheet have same data format&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2018 09:21:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-multiple-excel-sheets-containing-different-data-in-one/m-p/47376#M784767</guid>
      <dc:creator>atiyaharem</dc:creator>
      <dc:date>2018-03-05T09:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Loading multiple excel sheets containing different data in one go using for loop</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-multiple-excel-sheets-containing-different-data-in-one/m-p/47377#M784768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Atiya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The below script consolidate all excel files and sheets into singe table. If you have any issues with the below code, I would suggest you to attach sample excel files and post expected output. Good luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15203098339444926" jivemacro_uid="_15203098339444926"&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;Load '' as DummyField AutoGenerate 0;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;FOR EACH file in FileList('C:\Users\Tamil\Desktop\*.xlsx');&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ODBC CONNECT32 TO [Excel Files;DBQ=$(file)];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Temp:&lt;/P&gt;
&lt;P&gt;SQLtables;&lt;/P&gt;
&lt;P&gt;DISCONNECT;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;FOR i = 0 to NoOfRows('Temp')-1&lt;/P&gt;
&lt;P&gt;LET vSheetName = PurgeChar(Peek('TABLE_NAME', i, 'Temp'), chr(36));&lt;/P&gt;
&lt;P&gt;LET vSheetName = Replace(vSheetName,chr(39) &amp;amp; chr(39),chr(39));&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Concatenate (Data)&lt;/P&gt;
&lt;P&gt;Table:&lt;/P&gt;
&lt;P&gt;Load * ,&lt;/P&gt;
&lt;P&gt;FileBaseName()&amp;nbsp;&amp;nbsp; as File&lt;SPAN style="font-size: 9pt;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;FileName()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as File_Name,&lt;/P&gt;
&lt;P&gt;'$(vSheetName)'&amp;nbsp; as Sheet_name&lt;/P&gt;
&lt;P&gt;From $(file)(ooxml, embedded labels, table is [$(vSheetName)]);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NEXT i&lt;/P&gt;
&lt;P&gt;Drop table Temp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Next&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DROP Field DummyField;&lt;/P&gt;


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2018 04:20:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-multiple-excel-sheets-containing-different-data-in-one/m-p/47377#M784768</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2018-03-06T04:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Loading multiple excel sheets containing different data in one go using for loop</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-multiple-excel-sheets-containing-different-data-in-one/m-p/47378#M784770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Atiya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Code to Access all files in directory (subdirectories)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;SUB&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; DoDir (Root)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;FOR&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; each File in filelist(Root&amp;amp; '\*.xls')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;Tab1:&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LOAD&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;&amp;lt;&amp;lt;Field Names&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;FROM&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: #646464;"&gt;[$(File)]&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;biff&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;embedded&lt;/SPAN&gt; &lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;labels&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;table&lt;/SPAN&gt; &lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;is&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; &amp;lt;&amp;lt;Table name&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;$&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;NEXT&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; File&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;FOR&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; each Dir in dirlist (Root&amp;amp;'\*')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;CALL&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; DoDir(Dir)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;NEXT&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; Dir&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;END&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;SUB&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;CALL&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; DoDir('Your Directory'); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Code to Access All sheets in a Excel work book&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;Directory;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;for&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; a=1 &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;to&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;LOAD&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;employee&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;FROM&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;Looping\constructs1.xlsx // this is the excel sheet name&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;ooxml&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;embedded&lt;/SPAN&gt; &lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;labels&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;table&lt;/SPAN&gt; &lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;is&lt;/SPAN&gt; &lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;Sheet&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: #646464;"&gt;$(a)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;;// $ sign allows to access the value of a&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-IN" style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Next &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2018 04:37:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-multiple-excel-sheets-containing-different-data-in-one/m-p/47378#M784770</guid>
      <dc:creator>amit_saini</dc:creator>
      <dc:date>2018-03-06T04:37:06Z</dc:date>
    </item>
  </channel>
</rss>

