From password-protected Excel file to pandas DataFrame

前端 未结 4 890
青春惊慌失措
青春惊慌失措 2020-12-15 11:42

I can open a password-protected Excel file with this:

import sys
import win32com.client
xlApp = win32com.client.Dispatch(\"Excel.Application\")
print \"Excel         


        
4条回答
  •  -上瘾入骨i
    2020-12-15 12:05

    Assuming that you can save the encrypted file back to disk using the win32com API (which I realize might defeat the purpose) you could then immediately call the top-level pandas function read_excel. You'll need to install some combination of xlrd (for Excel 2003), xlwt (also for 2003), and openpyxl (for Excel 2007) first though. Here is the documentation for reading in Excel files. Currently pandas does not provide support for using the win32com API to read Excel files. You're welcome to open up a GitHub issue if you'd like.

提交回复
热议问题