ValueError: Min value is 0

Issue #1002 resolved
Ding Li
created an issue

I tried to read the attached workbook using openpyxl 2.5.1 but got an error ValueError: Min value is 0. Could you please help resolve the issue? The read script is below. thanks

Python 3.6.4 (default, Jan 30 2018, 14:37:12) 
[GCC 6.3.0 20170406] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openpyxl
>>> wb=openpyxl.load_workbook('a.xlsm')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ding/projects/nexant/pacwsb/lib/python3.6/site-packages/openpyxl/reader/excel.py", line 273, in load_workbook
    for c in find_charts(archive, rel.target):
  File "/home/ding/projects/nexant/pacwsb/lib/python3.6/site-packages/openpyxl/chart/reader.py", line 48, in find_charts
    drawing = SpreadsheetDrawing.from_tree(tree)
  File "/home/ding/projects/nexant/pacwsb/lib/python3.6/site-packages/openpyxl/descriptors/serialisable.py", line 84, in from_tree
    obj = desc.expected_type.from_tree(el)
  File "/home/ding/projects/nexant/pacwsb/lib/python3.6/site-packages/openpyxl/descriptors/serialisable.py", line 84, in from_tree
    obj = desc.expected_type.from_tree(el)
  File "/home/ding/projects/nexant/pacwsb/lib/python3.6/site-packages/openpyxl/descriptors/serialisable.py", line 84, in from_tree
    obj = desc.expected_type.from_tree(el)
  File "/home/ding/projects/nexant/pacwsb/lib/python3.6/site-packages/openpyxl/descriptors/serialisable.py", line 100, in from_tree
    return cls(**attrib)
  File "/home/ding/projects/nexant/pacwsb/lib/python3.6/site-packages/openpyxl/drawing/fill.py", line 94, in __init__
    self.t = t
  File "/home/ding/projects/nexant/pacwsb/lib/python3.6/site-packages/openpyxl/descriptors/base.py", line 109, in __set__
    raise ValueError('Min value is {0}'.format(self.min))
ValueError: Min value is 0
>>> 

Comments (7)

  1. CharlieC

    Thanks for the report. The problem is caused by the attributes on one of the DrawingML elements. While openpyxl only preserves charts, it needs to read everything in a drawing.xml to find out which items are charts and how to position them.

    In this particular case the problem was caused by a change in the specification from the early working draft where percentages were represented by 1/10000ths — 1 became 0.01% and that they could also be negative. So I got the initial implementation in openpyxl incorrect. Until this is fixed you should be okay if you use version 2.4, though this will mean you lose any charts in the file.

  2. Ivan C

    Hi, I have the same problem, I've tried from openpyxl 2.1 - 2.5 versions and got the same error, do you know more about this bug?

    thanks in advance.

  3. Log in to comment