Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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?
Solved! Go to Solution.
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
Please accept the answer and give kudos if this is helpful
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!
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.
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!
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.
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!
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
Please accept the answer and give kudos if this is helpful
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!