Forum Discussion

juan jimenez's avatar
juan jimenez
Iron Contributor
Dec 02, 2021
Solved

Get Data From File - how to delete empty cells

hi,    i am trying to get data from many files like these 2 attached.   Unfotunatelly, I get a lot of empty cells. i have tried to delete empty colonnes and rows but the Get Data funtion keeps on...
  • SergeiBaklan's avatar
    Dec 02, 2021

    juan jimenez 

    You may Clean All in source files,  if by Power Query you may apply function on second step

    (Source as table) as table =>
    
    let
        RemoveEmptyColumns = Table.SelectColumns(
            Source,
            List.Select(
                Table.ColumnNames(Source),
                each List.NonNullCount(Table.Column(Source,_)) <> 0
            )
        ),
        RemoveEmptyRows = Table.SelectRows(
            RemoveEmptyColumns,
            each not List.IsEmpty(List.RemoveMatchingItems( Record.FieldValues(_), {"", null} ) )
        )
    in
        RemoveEmptyRows