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.

  • how to read password protected excel in python

  • How to open write reserved excel file in python with win32com?

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, 2022 in Database by Edureka
• 13,690 points
10,009 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, 2022 by gaurav
• 23,260 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, 2022 in Database by anonymous
688 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, 2022 in Database by gaurav
• 23,260 points
2,329 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, 2022 in Database by Edureka
• 13,690 points
7,827 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,020 points
1,566 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, 2022 in Database by Neha
• 9,020 points
762 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, 2022 in Database by Edureka
• 13,690 points
773 views
0 votes
1 answer

Converting a large XML file to Excel

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

answered Mar 24, 2022 in Database by gaurav
• 23,260 points
2,838 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, 2022 in Database by gaurav
• 23,260 points
2,058 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP