<?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 Append - data source error in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Append-data-source-error/m-p/1959637#M57763</link>
    <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I would like to append multiple data source, but when one data source not found, i'm unable to append other tables.&lt;/P&gt;&lt;P&gt;How to handle this error, since few data might not come on daily basis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting 25 sheets in a spreadsheet, i'm transforming each sheet seperately and append at the end.&lt;/P&gt;&lt;P&gt;I'm considering sheet name as table name, some sheets not come on daily basis, so im getting data source error.&lt;/P&gt;&lt;P&gt;Suggest me better solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 10:25:28 GMT</pubDate>
    <dc:creator>babuInba</dc:creator>
    <dc:date>2021-07-15T10:25:28Z</dc:date>
    <item>
      <title>Append - data source error</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Append-data-source-error/m-p/1959637#M57763</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I would like to append multiple data source, but when one data source not found, i'm unable to append other tables.&lt;/P&gt;&lt;P&gt;How to handle this error, since few data might not come on daily basis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting 25 sheets in a spreadsheet, i'm transforming each sheet seperately and append at the end.&lt;/P&gt;&lt;P&gt;I'm considering sheet name as table name, some sheets not come on daily basis, so im getting data source error.&lt;/P&gt;&lt;P&gt;Suggest me better solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 10:25:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Append-data-source-error/m-p/1959637#M57763</guid>
      <dc:creator>babuInba</dc:creator>
      <dc:date>2021-07-15T10:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Append - data source error</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Append-data-source-error/m-p/1960877#M57812</link>
      <description>&lt;P&gt;If each of your sheets have the same data structure (columns), you should have a single query that combines them all instead of 25 separate queries.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://exceleratorbi.com.au/combine-all-sheets-in-a-workbook-with-power-query/" target="_blank"&gt;Combine All Sheets in a Workbook with Power Query - Excelerator BI&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pat&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 22:23:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Append-data-source-error/m-p/1960877#M57812</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2021-07-15T22:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Append - data source error</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Append-data-source-error/m-p/1965251#M57925</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="218737" data-lia-user-login="babuInba" class="lia-mention lia-mention-user"&gt;babuInba&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The video Pat shares is awesome. However, if your sheets don't have the same structure thus you have to transform them in separate queries before appending, you could refer to my practice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuem I have 3 queries to be append, among them Sheet3 may not exist sometimes. Its original M codes before appending are as follows. It has 7 columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Excel.Workbook(File.Contents("......\Test.xlsx"), null, true),
    Sheet3_Sheet = Source{[Item="Sheet3",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet3_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Sheet", Int64.Type}, {"Customer", type text}, {"Category", type text}, {"Product", type text}, {"Quantity", Int64.Type}, {"Price", Int64.Type}, {"Amount", Int64.Type}})
in
    #"Changed Type"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When this sheet doesn't exist in the workbook, it will raise error. So we need to deal with the error. You can refer to&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/powerquery-m/m-spec-error-handling" target="_blank" rel="noopener"&gt;M Language Error Handling&lt;/A&gt; for more instruction. Here what I do is to transform the codes into below one. Add&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;parentheses&lt;/STRONG&gt; to wrap original codes and add &lt;STRONG&gt;&lt;EM&gt;try&lt;/EM&gt; &lt;/STRONG&gt;before them. At the end, add &lt;EM&gt;&lt;STRONG&gt;otherwise&lt;/STRONG&gt; &lt;/EM&gt;and return an empty table. You could also hard code column headers to return an empty table with only column headers.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;try
(
    let
        Source = Excel.Workbook(File.Contents("......\Test.xlsx"), null, true),
        Sheet3_Sheet = Source{[Item="Sheet3",Kind="Sheet"]}[Data],
        #"Promoted Headers" = Table.PromoteHeaders(Sheet3_Sheet, [PromoteAllScalars=true]),
        #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Sheet", Int64.Type}, {"Customer", type text}, {"Category", type text}, {"Product", type text}, {"Quantity", Int64.Type}, {"Price", Int64.Type}, {"Amount", Int64.Type}})
    in
        #"Changed Type"
)
otherwise
    // #table({"Sheet","Customer","Category","Product","Quantity","Price","Amount"},{})
    #table({},{})&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this way, when a sheet cannot be found, it returns an empty table which can be referred to in&amp;nbsp;Table.Combine function.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards, &lt;BR /&gt;Community Support Team _ Jing&lt;BR /&gt;If this post helps, please Accept it as the solution to help other members find it.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 09:35:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Append-data-source-error/m-p/1965251#M57925</guid>
      <dc:creator>v-jingzhang</dc:creator>
      <dc:date>2021-10-12T09:35:34Z</dc:date>
    </item>
  </channel>
</rss>

