Home > Enterprise >  How to open a excel file in edit mode?
How to open a excel file in edit mode?

Time:12-09

I have multiple excel files in a folder and I want to open them using os library in python. I am using a command to open the excel file but it sometimes opens it in the read_only format. Command is:

os.startfile(path)

but it is open in the read_only mode and shows this message before opening it. enter image description here

I want to open it in edit mode, can somebody please help?

CodePudding user response:

In order to open the file in edit mode, just specify it like this:

os.startfile(filename, 'edit')     # Can specify 'edit' as the operation

CodePudding user response:

You should specify the operation that you want to do with startfile() method. For example, in this case you require 'edit', so: startfile(path, 'edit')

(https://docs.python.org/library/os.html#os.startfile)

  • Related