Forum Discussion
Macro in Excel not executing when opened up in Power BI Service
- 1 year ago
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 programmaticallyOffice 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
- 1 year ago
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 ,
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!