Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
dp1900
Frequent Visitor

Not all files contains the sheet selected when Transformed and it's giving error

Is there a function or script to check whether a sheet or tab from the multiple spreadsheets that is being combined exists? The reason is after selecting a specific tab as source and performed a combine/transform, some files doesn't have the specific tab/resource specified and therefore giving me an error and it stops there.

 

Example:

= Source{[Item="Transaction",Kind="Sheet"]}[Data]

 

The 'Transaction' sheet doesn't exist on the next file being transfomed and therefore the query gives an error and won't proceed on the rest of the files.  Can someone help? Thanks in advance.

1 ACCEPTED SOLUTION
jbwtp
Memorable Member
Memorable Member

Hi @dp1900,

 

Technically, there is a flag on the import wizard form (bottom-lef corner):

jbwtp_0-1661380189413.png

 

It generates a code to skip files with errors (including missing tabs) by adding something like this:

= Table.RemoveRowsWithErrors(#"Removed Other Columns1", {"Transform File"})

 

Or you can transform the helper function to something like this, if you want to have more control (e.g. conditionally substitute tab names orsomething alike):

let
    Source = Excel.Workbook(Parameter1, null, true),
    Check = List.Contains(Source[Name], "P&L")
in
    if Check then Source{[Item="P&L",Kind="Sheet"]}[Data] else #table({},{})

 

Cheers,

John

 

View solution in original post

2 REPLIES 2
dp1900
Frequent Visitor

Thank you 👍

jbwtp
Memorable Member
Memorable Member

Hi @dp1900,

 

Technically, there is a flag on the import wizard form (bottom-lef corner):

jbwtp_0-1661380189413.png

 

It generates a code to skip files with errors (including missing tabs) by adding something like this:

= Table.RemoveRowsWithErrors(#"Removed Other Columns1", {"Transform File"})

 

Or you can transform the helper function to something like this, if you want to have more control (e.g. conditionally substitute tab names orsomething alike):

let
    Source = Excel.Workbook(Parameter1, null, true),
    Check = List.Contains(Source[Name], "P&L")
in
    if Check then Source{[Item="P&L",Kind="Sheet"]}[Data] else #table({},{})

 

Cheers,

John

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors
Top Kudoed Authors