Skip to content

Commit

Permalink
feat: Recalculate dimensions if reported as A1:A1
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Nov 7, 2023
1 parent 9bcf2a1 commit d4bd195
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.4.0 - November 7, 2023
------------------------

* The ``reset_dimensions`` argument to :meth:`.Table.from_xlsx` defaults to ``None`` instead of ``False``. If ``reset_dimensions`` is ``None``, and if the worksheet's dimensions are ``A1:A1``, recalculate the worksheet's dimensions. To disable this behavior, set ``reset_dimensions`` to ``False``.

0.3.0 - October 30, 2023
------------------------

Expand Down
4 changes: 2 additions & 2 deletions agateexcel/table_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


def from_xlsx(cls, path, sheet=None, skip_lines=0, header=True, read_only=True,
reset_dimensions=False, row_limit=None, **kwargs):
reset_dimensions=None, row_limit=None, **kwargs):
"""
Parse an XLSX file.
Expand Down Expand Up @@ -72,7 +72,7 @@ def from_xlsx(cls, path, sheet=None, skip_lines=0, header=True, read_only=True,
offset = 0
rows = []

if read_only and reset_dimensions:
if read_only and (reset_dimensions or reset_dimensions is None and sheet.calculate_dimension() == 'A1:A1'):
sheet.reset_dimensions()
sheet.calculate_dimension(force=True)

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

project = 'agate-excel'
copyright = '2017, Christopher Groskopf'
version = '0.3.0'
version = '0.4.0'
release = version

# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='agate-excel',
version='0.3.0',
version='0.4.0',
description='agate-excel adds read support for Excel files (xls and xlsx) to agate.',
long_description=long_description,
long_description_content_type='text/x-rst',
Expand Down

0 comments on commit d4bd195

Please sign in to comment.