Power Query: discard all the rows starting from the first empty line

6diegodiego9

Board Regular
Joined
Jan 9, 2018
Messages
80
Office Version
  1. 2016
Platform
  1. Windows
I've an Excel worksheet like this:

ORDINEANNOMESEGIORNO
1252020105
120202255
1002020317
502019318
garbage….
garbage….
garbage….

How can I say in Power Query to discard all the rows starting from the first empty line?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    lst = Table.ToRows(Source),
    row = List.PositionOf(lst, List.Repeat({null},Table.ColumnCount(Source))),
    Result = if row>-1 then Table.FirstN(Source, row) else Source
in
    Result

Book1
ABCDEFGHIJ
1ORDINEANNOMESEGIORNOORDINEANNOMESEGIORNO
212520201051252020105
3120202255120202255
410020203171002020317
5502019318502019318
6
7garbage….
8garbage….
9garbage….
10
Sheet1
 
Upvote 0
Solution
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    lst = Table.ToRows(Source),
    row = List.PositionOf(lst, List.Repeat({null},Table.ColumnCount(Source))),
    Result = if row>-1 then Table.FirstN(Source, row) else Source
in
    Result

Book1
ABCDEFGHIJ
1ORDINEANNOMESEGIORNOORDINEANNOMESEGIORNO
212520201051252020105
3120202255120202255
410020203171002020317
5502019318502019318
6
7garbage….
8garbage….
9garbage….
10
Sheet1
It works!
Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,215,237
Messages
6,123,800
Members
449,127
Latest member
Cyko

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top