Search code examples
python-3.xxlrd

Python returns a different excel file name while parsing


I have a folder where the name of the folder is 158851 and it has a single excel file named 158851-2.XLSX, but while I read it through the code below it shows a weird name like below appending a ~$ before the actual file name.

 import xlrd
 df = xlrd.open_workbook("C://Users//xyz//Documents//Auto_Excel//abc//temp//158851//158851-2.XLSX",on_demand=True)

C://Users//cheta//Documents//Auto_Excel//Nag//temp//158851//~$158851-2.XLSX


Solution

  • I ran into similar situation, here is what you may need to check.

    Get into 158851 folder and check properties there. Check if you have a hidden file or a empty file, also check why your code is unable to handle that particular file.