'xlwings book open excel workbook but change the file name to lowercase
I used xlwings to open excel workbook. It worked fine up to last month. But today, when I run the same code, it opened my worksheet but convert my worksheet name into lowercase.
Anybody know why is that? And how can I keep my original captalization?
I am using windows 10.
Example, when I run below code, the ABC.xlsx automatically converted abc.xlsx by xlwings.
import xlwings as xw
fullPath = ''\\\\xxx\\xxx\\ABC.xlsx'
psw = '123'
wb = xw.Book(fullPath, password = psw)
Solution 1:[1]
I had the same issue and I am not sure why it does that (I think it only happens to protected workbooks). An easy fix is renaming the file again as follows:
import os
old_file_name = os.path.split(fullPath)[0] +'\\' + os.path.split(fullPath)[1].lower()
new_file_name = fullPath
os.rename(old_file_name, new_file_name)
This code assumes that your path and file are saved under fullPath.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |