Performance

openpyxl attempts to balance functionality and performance. Where in doubt, we have focused on functionality over optimisation: performance tweaks are easier once an API has been established. Memory use is fairly high in comparison with other libraries and applications and is approximately 50 times the original file size, e.g. 2.5 GB for a 50 MB Excel file. As many use cases involve either only reading or writing files, the Read-only mode modes mean this is less of a problem.

Benchmarks

All benchmarks are synthetic and extremely dependent upon the hardware but they can nevertheless give an indication. The benchmarks can be adjusted to use more sheets and adjust the proportion of data that is strings. Because the version of Python being used can also significantly affect performance, a driver script can also be used to test with different Python versions with a tox environment.


Versions:
python: 2.7.1
openpyxl: 2.5.7
xlsxwriter: 1.0.9

Dimensions:
    Rows = 1000
    Cols = 50
    Sheets = 4
    Proportion text = 0.10

Times:
    xlsxwriter            :   2.69
    xlsxwriter (optimised):   2.48
    openpyxl              :   4.59
    openpyxl (optimised)  :   3.65


Versions:
python: 3.5.6
openpyxl: 2.5.7
xlsxwriter: 1.0.9

Dimensions:
    Rows = 1000
    Cols = 50
    Sheets = 4
    Proportion text = 0.10

Times:
    xlsxwriter            :   3.20
    xlsxwriter (optimised):   3.08
    openpyxl              :   5.54
    openpyxl (optimised)  :   3.95


Versions:
python: 3.6.6
openpyxl: 2.5.7
xlsxwriter: 1.0.9

Dimensions:
    Rows = 1000
    Cols = 50
    Sheets = 4
    Proportion text = 0.10

Times:
    xlsxwriter            :   3.18
    xlsxwriter (optimised):   3.02
    openpyxl              :   4.28
    openpyxl (optimised)  :   3.34


Versions:
python: 3.7.0
openpyxl: 2.5.7
xlsxwriter: 1.0.9

Dimensions:
    Rows = 1000
    Cols = 50
    Sheets = 4
    Proportion text = 0.10

Times:
    xlsxwriter            :   3.02
    xlsxwriter (optimised):   2.94
    openpyxl              :   4.11
    openpyxl (optimised)  :   3.12