0

ive successfully decrypted xlsx file using cmd = "msoffcrypto-tool hello.xlsx decrypted.xlsx -p erh1" os.system(cmd)

but when i open the decrypted.xlsx using wb = load_workbook(inputFilePath, data_only=True)

i get few warnings and and errors but it opens fine, i want to remove these errors

  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/descriptors/base.py", line 55, in _convert
    value = expected_type(value)
ValueError: could not convert string to float: '(#REF!-40)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/worksheet/_reader.py", line 280, in parse_formatting
    cf = ConditionalFormatting.from_tree(element)
  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/descriptors/serialisable.py", line 87, in from_tree
    obj = desc.expected_type.from_tree(el)
  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/descriptors/serialisable.py", line 87, in from_tree
    obj = desc.expected_type.from_tree(el)
  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/descriptors/serialisable.py", line 87, in from_tree
    obj = desc.expected_type.from_tree(el)
  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/descriptors/serialisable.py", line 103, in from_tree
    return cls(**attrib)
  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/formatting/rule.py", line 57, in __init__
    self.val = val
  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/formatting/rule.py", line 36, in __set__
    super(ValueDescriptor, self).__set__(instance, value)
  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/descriptors/base.py", line 67, in __set__
    value = _convert(self.expected_type, value)
  File "/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/descriptors/base.py", line 57, in _convert
    raise TypeError('expected ' + str(expected_type))
TypeError: expected <class 'float'>

  warn(msg)
/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/worksheet/_reader.py:300: UserWarning: Data Validation extension is not supported and will be removed
  warn(msg)
/home/muhammadu/.local/lib/python3.8/site-packages/openpyxl/worksheet/_reader.py:300: UserWarning: Conditional Formatting extension is not supported and will be removed
  warn(msg)

or is there any other way to decrypt xlsx using python ? i used msoffcrypto-tool

1 Answer 1

0

If you have a line that starts with xlwb, you should ensure that you have the proper code after it.

To open a protected file, you should have:

xlwb = xlApp.Workbooks.Open(filename, False, True, None, password)

That should hopefully work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.