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
MikeGanem
New Member

Macro in Excel not executing when opened up in Power BI Service

I have an Excel file (xlsm) in OneDrive which has a Macro executed within VBA when file is opened.

I created a Power BI Online report using that .xlsm, the report opens up but the macro isn't executed when report opens up the Excel file.

What do I do to get the Macror or VBA to run?

2 ACCEPTED SOLUTIONS
nilendraFabric
Super User
Super User

Hello @MikeGanem 

 

Power BI Service does not support the execution of VBA macros or other automation scripts embedded in Excel files. Power BI is designed to work with data and visualizations, and while it can import data from Excel files, it does not execute any macros or scripts contained within those files. When importing Excel workbooks into Power BI, only the data is imported, and features like VBA macros or additional plugins are blocked.


For advanced automation needs, consider using Power BI’s REST API to trigger actions such as refreshing datasets or exporting data programmatically

 

Office scripts can be used within Excel to automate tasks and can be integrated with Power Automate for workflows involving both Excel and Power BI

 

https://community.powerplatform.com/forums/thread/details/?threadid=ccca3760-a070-4369-9c41-c57e70d0...

 

Please accept the answer and give kudos if this is helpful 

 

 

View solution in original post

Poojara_D12
Super User
Super User

Hi @MikeGanem 

Power BI does not support running VBA macros from an .xlsm file when refreshing data. When Power BI accesses the file, it treats it as a static data source and does not execute macros. To ensure the macro runs before Power BI refreshes, you can use Power Automate or Windows Task Scheduler to open the file, trigger the macro, save it, and then refresh the dataset. If the macro is for data transformation, consider recreating its logic using Power Query or Power Automate. Another option is to manually open the file, let the macro run, save it, and then refresh the Power BI report. If feasible, export the processed data to a separate .xlsx file and have Power BI read from that instead. Additionally, using Power Automate Desktop can automate Excel operations before Power BI refreshes. The key is ensuring the macro completes before Power BI accesses the file to avoid missing data updates. Let me know if you need help setting up an automation workflow!

 

fabric-community-super-user-fy24-25.png

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @MikeGanem ,
As we have not received a response from you yet, I would like to confirm whether you have successfully resolved the issue or if you require further assistance.

If the issue has been resolved, please mark the helpful reply as a "solution" to indicate that the question has been answered and to assist others in the community.
Thank you for your cooperation. Have a great day.

Anonymous
Not applicable

Hi @MikeGanem ,
We haven't heard back from you regarding our last response and wanted to check if your issue has been resolved. If our response addressed your query, please mark it as Accept Answer and click Yes if you found it helpful.If you have any further questions, feel free to reach out.

Thank you for being a part of the Microsoft Fabric Community Forum!

Anonymous
Not applicable

Hi @MikeGanem ,
Thank you for the helpful repsonse @nilendraFabric  and @Poojara_D12.

I just wanted to follow up and check if you had a chance to review the response from NilendraFabric and Poojara_D12. If it addressed your query, kindly mark it as "Accept as solution." If still encountering any issues, please don't hesitate to reach out.

Thank you for being a part of Microsoft Fabric Community Forum!

Regards,
Pallavi.

Poojara_D12
Super User
Super User

Hi @MikeGanem 

Power BI does not support running VBA macros from an .xlsm file when refreshing data. When Power BI accesses the file, it treats it as a static data source and does not execute macros. To ensure the macro runs before Power BI refreshes, you can use Power Automate or Windows Task Scheduler to open the file, trigger the macro, save it, and then refresh the dataset. If the macro is for data transformation, consider recreating its logic using Power Query or Power Automate. Another option is to manually open the file, let the macro run, save it, and then refresh the Power BI report. If feasible, export the processed data to a separate .xlsx file and have Power BI read from that instead. Additionally, using Power Automate Desktop can automate Excel operations before Power BI refreshes. The key is ensuring the macro completes before Power BI accesses the file to avoid missing data updates. Let me know if you need help setting up an automation workflow!

 

fabric-community-super-user-fy24-25.png

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
nilendraFabric
Super User
Super User

Hello @MikeGanem 

 

Power BI Service does not support the execution of VBA macros or other automation scripts embedded in Excel files. Power BI is designed to work with data and visualizations, and while it can import data from Excel files, it does not execute any macros or scripts contained within those files. When importing Excel workbooks into Power BI, only the data is imported, and features like VBA macros or additional plugins are blocked.


For advanced automation needs, consider using Power BI’s REST API to trigger actions such as refreshing datasets or exporting data programmatically

 

Office scripts can be used within Excel to automate tasks and can be integrated with Power Automate for workflows involving both Excel and Power BI

 

https://community.powerplatform.com/forums/thread/details/?threadid=ccca3760-a070-4369-9c41-c57e70d0...

 

Please accept the answer and give kudos if this is helpful 

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors