How to open a password protected excel file using python

0 votes

I looked at the previous threads regarding this topic, but they have not helped solve the problem.

I'm trying to open a password protected file in excel without any user interaction. I searched online, and found this code which uses win32com.client When I run this, I still get the prompt to enter the password...

from xlrd import *
import win32com.client
import csv
import sys

xlApp = win32com.client.Dispatch("Excel.Application")
print "Excel library version:", xlApp.Version
filename,password = r"\\HRA\Myfile.xlsx", 'caa team'
xlwb = xlApp.Workbooks.Open(filename, Password=password)

Apr 6 in Database by Edureka
• 13,640 points
922 views

1 answer to this question.

0 votes

I recently came upon a Python package that simplifies this process.

It doesn't require Excel to run, and it's also cross-platform because it's written in Python.

Microsoft Office password-protected (encrypted) documents, including the older XLS binary file format, are supported by msoffcrypto-tool.

Install msoffcrypto-tool:

 pip install msoffcrypto-tool

From the command line, you might make an unencrypted version of the workbook:

msoffcrypto-tool Myfile.xlsx Myfile-decrypted.xlsx -p "caa team"
answered Apr 6 by gaurav
• 13,560 points

Related Questions In Database

0 votes
1 answer

How to read a .xlsx file using the pandas Library in iPython?

Every sheet gets its own DataFrame, which ...READ MORE

answered Mar 25 in Database by anonymous
41 views
0 votes
1 answer

How to translate a BDS excel-formula to XBBG API for Python

The parameters are improperly specified by you. ...READ MORE

answered Apr 1 in Database by gaurav
• 13,560 points
116 views
0 votes
1 answer

How to download created excel file in node.js using exceljs

Download a sample Excel file using Node. ...READ MORE

answered Apr 4 in Database by Edureka
• 13,640 points
966 views
+2 votes
1 answer

How to export data from MySql to a CSV file?

If you are using MySql workbench then ...READ MORE

answered Jan 4, 2019 in Database by Priyaj
• 58,080 points
410 views
0 votes
1 answer

How to rename a column in a database table using SQL?

For SQL Server, use sp_rename USE AdventureWorks; GO EXEC sp_rename 'Customers.CustomerTerritory.TerritoryID', ...READ MORE

answered Feb 9 in Database by Neha
• 8,560 points
67 views
0 votes
0 answers

How to import JSON file to Excel without coding?

Let's say you have a file named input.json which ...READ MORE

Feb 24 in Database by Edureka
• 13,640 points
36 views
0 votes
1 answer

Converting a large XML file to Excel

Using the web URL, import an XML ...READ MORE

answered Mar 24 in Database by gaurav
• 13,560 points
219 views
0 votes
1 answer

[Excel][VBA] How to draw a line in a graph?

Sub MakeChart() Dim x(20) ...READ MORE

answered Mar 24 in Database by gaurav
• 13,560 points
79 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP