<?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 all excel files from a folder where columns don't match in Management &amp; Governance</title>
    <link>https://community.qlik.com/t5/Management-Governance/Loading-all-excel-files-from-a-folder-where-columns-don-t-match/m-p/1681404#M15686</link>
    <description>&lt;P&gt;Yes, I suppose I could.&amp;nbsp; The example I shared is very basic.&amp;nbsp; In reality, I have over 150 fields and I wanted to make the code more elegant by using specific field names.&amp;nbsp; &amp;nbsp;I want to be able to write something more specific for only the field names I wanted.&amp;nbsp; I will try that if there is no other way.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Mar 2020 16:11:23 GMT</pubDate>
    <dc:creator>joseph_scorsone</dc:creator>
    <dc:date>2020-03-03T16:11:23Z</dc:date>
    <item>
      <title>Loading all excel files from a folder where columns don't match</title>
      <link>https://community.qlik.com/t5/Management-Governance/Loading-all-excel-files-from-a-folder-where-columns-don-t-match/m-p/1681377#M15684</link>
      <description>&lt;P&gt;I am trying to load all excel files from a specific folder, but a few of the files have a column missing.&amp;nbsp; &amp;nbsp;Qlik Sense is giving an error.&amp;nbsp; &amp;nbsp; I want to be able to load those files even if that column is missing.&amp;nbsp; &amp;nbsp;Does anyone Know how to handle this?&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;FileOne.xlsx has the columns&amp;nbsp; &amp;nbsp;FirstName, LastName, Address, Address_Line_1, City, State, Zip&lt;/P&gt;&lt;P&gt;FileTwo.xlsx only has the following:&amp;nbsp;&amp;nbsp;FirstName, LastName, Address, City, State, Zip&lt;/P&gt;&lt;P&gt;Becuase Address_Line_1 is missing, the load script fails.&amp;nbsp; &amp;nbsp;How do I prevent it from failing, but still bring in the other columns?&lt;/P&gt;&lt;P&gt;SET ErrorMode = 0; does not work, this keeps the script from failing, but does not load the other columns. It ignores the file completely.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:06:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Loading-all-excel-files-from-a-folder-where-columns-don-t-match/m-p/1681377#M15684</guid>
      <dc:creator>joseph_scorsone</dc:creator>
      <dc:date>2024-11-16T03:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Loading all excel files from a folder where columns don't match</title>
      <link>https://community.qlik.com/t5/Management-Governance/Loading-all-excel-files-from-a-folder-where-columns-don-t-match/m-p/1681399#M15685</link>
      <description>&lt;P&gt;Can you use&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 16:00:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Loading-all-excel-files-from-a-folder-where-columns-don-t-match/m-p/1681399#M15685</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2020-03-03T16:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Loading all excel files from a folder where columns don't match</title>
      <link>https://community.qlik.com/t5/Management-Governance/Loading-all-excel-files-from-a-folder-where-columns-don-t-match/m-p/1681404#M15686</link>
      <description>&lt;P&gt;Yes, I suppose I could.&amp;nbsp; The example I shared is very basic.&amp;nbsp; In reality, I have over 150 fields and I wanted to make the code more elegant by using specific field names.&amp;nbsp; &amp;nbsp;I want to be able to write something more specific for only the field names I wanted.&amp;nbsp; I will try that if there is no other way.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 16:11:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Loading-all-excel-files-from-a-folder-where-columns-don-t-match/m-p/1681404#M15686</guid>
      <dc:creator>joseph_scorsone</dc:creator>
      <dc:date>2020-03-03T16:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Loading all excel files from a folder where columns don't match</title>
      <link>https://community.qlik.com/t5/Management-Governance/Loading-all-excel-files-from-a-folder-where-columns-don-t-match/m-p/1681537#M15691</link>
      <description>&lt;P&gt;If the LOAD * would work, I would go for it.&amp;nbsp; I suppose there might be there the case where you would be concerned about loading a lot of extra data.&amp;nbsp; You could either drop the unwanted fields at the end or figure out up front which fields you want to load. In either case I suppose you would have a list of candidate fields you want to keep.&amp;nbsp; Here's an example of the upfront method.&amp;nbsp; The trick is to read the first row as data to get the labels and then pivot them into a list using CrossTable.&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;// Load candidate list once&lt;BR /&gt;LOAD&lt;/SPAN&gt; * &lt;SPAN class="s1"&gt;INLINE&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;[&lt;BR /&gt;ColumnCandidate&lt;BR /&gt;Sort Order&lt;BR /&gt;Common Name&lt;BR /&gt;Formal Name&lt;BR /&gt;Type&lt;BR /&gt;Sub Type&lt;BR /&gt;]&lt;/SPAN&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// Then for each file&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Columns:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;CrossTable&lt;/SPAN&gt; (&lt;SPAN class="s2"&gt;x&lt;/SPAN&gt;, &lt;SPAN class="s2"&gt;Colname&lt;/SPAN&gt;) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;LOAD&lt;/SPAN&gt; 1, *&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;FROM&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s2"&gt;[..\yourfile.csv]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(&lt;SPAN class="s1"&gt;txt&lt;/SPAN&gt;, &lt;SPAN class="s1"&gt;utf8&lt;/SPAN&gt;, &lt;SPAN class="s1"&gt;no&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;labels&lt;/SPAN&gt;, &lt;SPAN class="s1"&gt;delimiter&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;is&lt;/SPAN&gt; ',', &lt;SPAN class="s1"&gt;msq&lt;/SPAN&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;Where&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;RecNo&lt;/SPAN&gt;() = 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;TempList:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;LOAD&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;Concat&lt;/SPAN&gt;('[' &amp;amp; &lt;SPAN class="s2"&gt;Colname&lt;/SPAN&gt; &amp;amp; ']', ', ') &lt;SPAN class="s1"&gt;as&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;ColList&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;Resident&lt;/SPAN&gt; Columns&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;Where&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;Exists&lt;/SPAN&gt;(&lt;SPAN class="s2"&gt;ColumnCandidate&lt;/SPAN&gt;, &lt;SPAN class="s2"&gt;Colname&lt;/SPAN&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;LET&lt;/SPAN&gt; vColList = &lt;SPAN class="s1"&gt;peek&lt;/SPAN&gt;('ColList');&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;DROP&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;Table&lt;/SPAN&gt; Columns, TempList;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;FONT face="courier new,courier"&gt;Data:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LOAD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; $(vColList)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;FROM thefile.csv&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(&lt;SPAN class="s1"&gt;txt&lt;/SPAN&gt;, &lt;SPAN class="s1"&gt;utf8&lt;/SPAN&gt;, &lt;SPAN class="s1"&gt;embedded&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;labels&lt;/SPAN&gt;, &lt;SPAN class="s1"&gt;delimiter&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;is&lt;/SPAN&gt; ',', &lt;SPAN class="s1"&gt;msq&lt;/SPAN&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P class="p1"&gt;At the bottom of this post is an example of the other option, "LOAD *" and then drop extra fields at the end of the process.&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;A href="https://qlikviewcookbook.com/2018/12/loading-varying-column-names/" target="_blank"&gt;https://qlikviewcookbook.com/2018/12/loading-varying-column-names/&lt;/A&gt;&lt;/P&gt;&lt;P class="p1"&gt;-Rob&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank" rel="noopener"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank" rel="noopener"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank" rel="noopener"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 02:08:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Loading-all-excel-files-from-a-folder-where-columns-don-t-match/m-p/1681537#M15691</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2020-03-04T02:08:59Z</dc:date>
    </item>
  </channel>
</rss>

