Forum Discussion

navafolk's avatar
navafolk
Helper IV
3 years ago
Solved

Ignore table query with Expression.Error The key didn't match any rows in the table

Hi pros, I have two queries need to append. -- 1st query (Query1): It is  picked from folder (C:\group_amount) with many spreadsheets (group_amount_yyyymm.xlsx). Each file contains data of a month,...
  • navafolk's avatar
    navafolk
    3 years ago

    Thank you @m_dekorte,

    Your way works great now. I just try other way round for the EmptyTable

    #table(0,{{}})

    (Create an empty table with M (microsoft.com))

    Transform File function in Power Query looks like:

    let
        Source = (Parameter1 as binary) => let
            Source = Excel.Workbook(Parameter1, null, true),
            #"Sheet" = try Source{[Item="20230515",Kind="Sheet"]}[Data] otherwise 1,
            IsMissing = if Sheet=1
            then #table(0,{{}})
            else let
            #"Removed Top Rows" = Table.Skip(#"Sheet",1),
            #"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true])
            in
            #"Promoted Headers"
            in IsMissing
    in
        Source

     then remove null row in Query1 and they are all beautiful now.