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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
msarfaraz
Frequent Visitor

Error in Refresh Data from Microsoft Exchange to Power BI attachment email

Hi Experst 

 

I am getting a error upon exporting attachment (Excel) file from microft exhange, i have created the all filter in edit query and its working fine on first stage, however when am receiving updat email next date I am getting error.

Picture1.png

 

let

    Source = Exchange.Contents("m.sarz@mhj.com"),

    Mail1 = Source{[Name="Mail"]}[Data],

    #"Expanded Sender" = Table.ExpandRecordColumn(Mail1, "Sender", {"Name", "Address"}, {"Sender.Name", "Sender.Address"}),

    #"Filtered Rows" = Table.SelectRows(#"Expanded Sender", each [Sender.Address] = "replies-abc@aol.com"),

    #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each Text.EndsWith([Subject], "Madinah Data BI")),

    #"Filtered Rows2" = Table.SelectRows(#"Filtered Rows1", let latest = List.Max(#"Filtered Rows1"[DateTimeSent]) in each [DateTimeSent] = latest),

    #"AAMkAGJiMTg2OGMzLWRlZDEtNDI0MC04OTlhLThiZDFiMWU1OTA0YgBGAAAAAACHHKVnuh1TTIzR3yhL8aLKBwAEgYm+4YUCSZJ3jmvsPvxCAAz6v6+nAAClbRZez8mURKjGea9RW6QMAAJK9RBeAAA=" = #"Filtered Rows2"{[Id="AAMkAGJiMTg2OGMzLWRlZDEtNDI0MC04OTlhLThiZDFiMWU1OTA0YgBGAAAAAACHHKVnuh1TTIzR3yhL8aLKBwAEgYm+4YUCSZJ3jmvsPvxCAAz6v6+nAAClbRZez8mURKjGea9RW6QMAAJK9RBeAAA="]}[Attachments],

    AttachmentContent = #"AAMkAGJiMTg2OGMzLWRlZDEtNDI0MC04OTlhLThiZDFiMWU1OTA0YgBGAAAAAACHHKVnuh1TTIzR3yhL8aLKBwAEgYm+4YUCSZJ3jmvsPvxCAAz6v6+nAAClbRZez8mURKjGea9RW6QMAAJK9RBeAAA="{0}[AttachmentContent],

    #"Imported Excel" = Excel.Workbook(AttachmentContent),

    Hotel_Sheet = #"Imported Excel"{[Item="Hotel",Kind="Sheet"]}[Data],

    #"Promoted Headers" = Table.PromoteHeaders(Hotel_Sheet, [PromoteAllScalars=true]),

    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Property Name", type text}, {"Account ID", type text}, {"DOW", type text}, {"Occupancy Date", Int64.Type}, {"Special Event (Impact Forecast = Yes)", type text},  {"User Forecast Rooms Sold", type text}, {"User Forecast Room Revenue (SAR)", type text}}),

    #"Changed Type with Locale" = Table.TransformColumnTypes(#"Changed Type", {{"Occupancy Date", type date}}, "en-NZ")

in

    #"Changed Type with Locale"

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@msarfaraz,

Do all the Excel attachments contain the "Hotel" sheet? And do the sheets contain same columns and same column names?

In your scenario, I would recommend you backup the PBIX file, then remove each APPLIED STEP from last step and check which step the error throws.

Regards,
Lydia

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@msarfaraz,

Do all the Excel attachments contain the "Hotel" sheet? And do the sheets contain same columns and same column names?

In your scenario, I would recommend you backup the PBIX file, then remove each APPLIED STEP from last step and check which step the error throws.

Regards,
Lydia

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.