jazzband / tablib

Python Module for Tabular Datasets in XLS, CSV, JSON, YAML, &c.
https://tablib.readthedocs.io/
MIT License
4.59k stars 590 forks source link

Update xlsx import to read cell values instead of cell formulas #461

Closed dragonworks closed 4 years ago

dragonworks commented 4 years ago

When importing an Excel xlsx file it reads the cell formulas instead of the cell values.

For example, if a cell has the formulas '=SUM(A1:A3)' it will read that string instead of the calculated number in Excel.

Passing data_only=True to openpyxl's load_workbook will load the cell values instead of formulas.

I think when importing an Excel spreadsheet it's the values that would be wanted and not the formulas?

codecov[bot] commented 4 years ago

Codecov Report

Merging #461 into master will increase coverage by 0.02%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #461      +/-   ##
==========================================
+ Coverage   90.42%   90.44%   +0.02%     
==========================================
  Files          28       28              
  Lines        2589     2606      +17     
==========================================
+ Hits         2341     2357      +16     
- Misses        248      249       +1     
Impacted Files Coverage Δ
src/tablib/formats/_xlsx.py 96.73% <100.00%> (ø)
tests/test_tablib.py 98.53% <100.00%> (+0.01%) :arrow_up:
src/tablib/formats/_xls.py 84.78% <0.00%> (+0.07%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b39aefb...476ddb5. Read the comment docs.

claudep commented 4 years ago

I think that makes sense. Could you please add:

dragonworks commented 4 years ago

Thanks, I've updated it with those changes. Hope that's okay, I'm kinda new to this.

claudep commented 4 years ago

That's great, thanks! I pushed minor edits to your patch, if you don't mind.

dragonworks commented 4 years ago

Thanks, I appreciate it!