Python Forum
Python read Password protected excel and convert to Pandas DataFrame - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Python read Password protected excel and convert to Pandas DataFrame (/thread-12548.html)



Python read Password protected excel and convert to Pandas DataFrame - FORTITUDE - Aug-30-2018

Hi All,

I am new to Python and now actively learning pandas.

I am trying to read a password protected excel file (prompt for password upon open). Surfing on the net and got below solution using win32com object.

xlApp = win32com.client.Dispatch("Excel.Application")
xlwb = xlApp.Workbooks.Open("c:\\temp\\SomeFile.xlsx", False, True, None, password)

However, I want to convert workbook xlwb into a pandas dataframe for some advance processing. I am struggle to find any efficient ways, except flush it to csv and read it again using pandas read_csv function.

Do you have any good suggestion to this?

Also the win32com solution won't be working in Linux server. Is there any generic/native solution so that Python program can read through a password protected excel in any operating systems?

Thank you very much.

Allen


RE: Python read Password protected excel and convert to Pandas DataFrame - buran - Aug-30-2018

https://davidhamann.de/2018/02/21/read-password-protected-excel-files-into-pandas-dataframe/

but still no linux


RE: Python read Password protected excel and convert to Pandas DataFrame - FORTITUDE - Aug-30-2018

Thank you Buran. Your link is good by promoting user to enter password on the fly when program opens the excel file.

However, my wish is to run everything in the background without manual intervention.

My colleague said Java can do this seamlessly so I think Python could do the same.