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

Can we handle error in Python Visual Script?

Greetings,

I am trying to extract table data into excel through python visual but if file with same filename is already open. It gives Permission denied error. I tried with try and except but it didnot work. Is there any way  to handle this error? TIA

 

Regards,

N

4 REPLIES 4
v-gizhi-msft
Community Support
Community Support

Hi,

 

Could you please give more info about your issue?

 

Best Regards,

Giotto

Anonymous
Not applicable

Hello Giotto,

1. I have written a code to export my table into an excel (say abc.xlsx). this works fine.

2. But if i have the same excel (abc.xlsx) open and try to run my code and save the excel with same name i get permission denied error.

How to handle this exception?

Technically i want to add a message window saying the file is already open.

TIA

 

vanessafvg
Community Champion
Community Champion

is the excel file open?  is that what you saying?  you need to close the excel file 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

Hello,

 

Yes, when the excel is open.

May users will be using this report and i am sure they will keep the excel file open and try to make changes to the report and run the code.

I am trying to add a message saying  excel file is open.

 

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.