Created
January 29, 2021 22:20
-
-
Save dominiksimgen/0037398cc88b39f8803516318c1ead71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://stackoverflow.com/questions/27556751/unprotect-an-excel-file-programmatically | |
#Windows | |
def Remove_password_xlsx(filename, pw_str): | |
xcl = win32com.client.Dispatch("Excel.Application") | |
wb = xcl.Workbooks.Open(filename, False, False, None, pw_str) | |
xcl.DisplayAlerts = False | |
wb.SaveAs(filename, None, '', '') | |
xcl.Quit() | |
# macOS | |
import pandas as pd | |
import xlwings as xw | |
def _process(filename): | |
wb = xw.Book(filename) | |
sheet = wb.sheets[0] | |
df = sheet.used_range.options(pd.DataFrame, index=False, header=True).value | |
wb.close() | |
return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment