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
Anonymous
Not applicable

How to automatically update data when opening the Excel file?

Hi - This is for Power Query in Excel with SQL DB connection. Is there a way to configure just so that the data is automatically updated everytime the user opens up Excel file? Also I have a senario where the report viewer doesn't have an access to SQL database and we can only allow Windows authentication to the database (SQL authentication is not allowed). Is it possible to configure impersonation or anything that would allow user to refresh data? Please advice.

 

Thanks!

2 ACCEPTED SOLUTIONS
mahoneypat
Microsoft Employee
Microsoft Employee

You can write a macro with VBA that triggers on open with the command Refresh.All

That will refresh all queries in the workbook.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

I am not aware of that, and would probably advise against it.  If you had a shared read only account to your database that anyone that would open your file had access to, that should work.

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

You can write a macro with VBA that triggers on open with the command Refresh.All

That will refresh all queries in the workbook.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

@mahoneypat Is there a way to do impersonation in excel macro? Thanks!

I am not aware of that, and would probably advise against it.  If you had a shared read only account to your database that anyone that would open your file had access to, that should work.

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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