Home > other >  Python operation excel, request to open the file, actual it is new, every time why ah
Python operation excel, request to open the file, actual it is new, every time why ah

Time:09-30

Python beginner, with application form open an existing file, only three lines of code, the path to the file no problem, after running won't open the file, but a new file, the prompt display keyerror, internal function called seems to be out of the question, please help have a look, thank you very much

CodePudding user response:

Try the full path? Is the drive from the beginning

CodePudding user response:

So give it a try?
 
The import xlwings as xw
App1=xw. App (visible=True, add_book=False)
. Books. The open ('/Users/chenqian/Desktop/x2. XLSX ')


If still won't do, see if there is something wrong with file permissions? Create a new excel file it one more try?

CodePudding user response:

Google search:
Xlwings open
Reference:
The Quickstart - xlwings dev documentation
Python API - xlwings dev documentation
Python - Open a Workbook with XLWINGS without making it visible - Stack Overflow
Refer to the website, open an existing excel, is:
 
The import xlwings as xw
Wb=xw. Book '/Users/chenqian/Desktop/x2. XLSX')

If you can, try,

CodePudding user response:

Thank you, I before is to use the iOS, then use Windows 10 python3, running the same program, may be where there is something wrong with the set of computer software, I check again,
  • Related