Check if someone has excel file open

i want to read and file my drawinglist in excel. But this is a excel sheet that is used by many people. When someone has it open, the scripting doesn’t work.
Is there a way to check if someone has the excel file open and if so. that you can stop the flow.

Arno

Kind of an interesting work(flow/around). When an Excel or Word document is open it creates a ‘read only’ type of file shown in the image below prefaced with ~$. Though, I’m not 100% sure if this is only a network thing or not.

The result of List.AnyTrue could be pushed forward to either continue your script or keep it on hold until the file is closed.

Good luck!

Edit: Instead of List.AnyTrue, using AllFalse will save you a step moving forward.

1 Like

Could also just copy the file, use it, and the delete the file afterwards. This way it wouldn’t matter if someone had it open all day every day.

Dana, thank you for your reply. This looks like an good and easy way. Only problem i don’t see the -$ file when i have the excel file open. (Yes i have hidden items turned on)

Jacob, it is a drawing list of the complete group… so if someone is editing the file and adding his project i need to get the next number, so if someone has it open i have to wait till it gets closed before i can fill out the drawinglist with dynamo automaticly when i start a project.

Looks like it still works with those files hidden! I’m not really sure at the moment how to reveal them in the file explorer windows, but the ~$ file does exist and is still available through the directory contents output.

Who would’ve thought! :grinning:

Capture

1 Like

Dana, you are right…wauw this works, amazing…thanks for the insight.