Export styles from Excel using OpenPyXL (for XlsxWriter -- pyexcel-xlsxwx).
$ pip install pyexcel-openpyxlx
>>> import pyexcel_openpyxlx
>>> pyexcel_openpyxlx.get_styles('example.xlsx')
{'worksheet': {'hanzi': {'freeze_panes': 'A2', 'column_width': [7.7109375, 28.7109375, 30.7109375, 8.7109375, 10.7109375, 16.7109375, 7.7109375, 6.7109375, 6.7109375, 30.7109375]}, 'sentences': {'freeze_panes': 'A2', 'column_width': [30.7109375, 30.7109375, 30.7109375, 30.7109375, 6.7109375, 6.7109375, 30.7109375]}, 'vocab': {'freeze_panes': 'A2', 'column_width': [7.7109375, 24.7109375, 24.7109375, 30.7109375, 30.7109375, 30.7109375, 7.7109375, 6.7109375, 6.7109375, 8.7109375, 30.7109375]}}}
Exporting to YAML is also possible by specifying out_file
.
>>> pyexcel_openpyxlx.get_styles('example.xlsx', out_file='example.yaml')
worksheet:
hanzi:
column_width: [7.7109375, 28.7109375, 30.7109375, 8.7109375, 10.7109375, 16.7109375,
7.7109375, 6.7109375, 6.7109375, 30.7109375]
freeze_panes: A2
sentences:
column_width: [30.7109375, 30.7109375, 30.7109375, 30.7109375, 6.7109375, 6.7109375,
30.7109375]
freeze_panes: A2
vocab:
column_width: [7.7109375, 24.7109375, 24.7109375, 30.7109375, 30.7109375, 30.7109375,
7.7109375, 6.7109375, 6.7109375, 8.7109375, 30.7109375]
freeze_panes: A2
- pyexcel-xlsxwx -- Save pyexcel data with XlsxWriter, while retaining good formatting.