-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
The current way to do it:
with open_excel(fpath) as wb:
sheet = wb[0]
sheet['A1'] = arr.dump()
# we must use Excel "custom format" syntax
sheet['B2'].xw_range.expand().number_format = '0,00'
# OR
sheet.range('B2').expand().number_format = '0,00'
# OR
sheet['B2:D3'].number_format = '0,00'
# for percents:
sheet['B2:D3'].number_format = '0,0%'But it is annoying to have to specify the range of the data, or even the "starting point" of the data.
- Technically, I think we will need to make Array.dump() return a "Dump" object instead of a simple list and implement a custom xlwings converter.
https://docs.xlwings.org/en/stable/converters.html#custom-converter - For the API, I imagine something like (but this needs more thoughts):
with open_excel(fpath) as wb:
sheet = wb[0]
sheet['A1'] = arr.dump(data_format='0,00')Solving this issue would probably add the infrastructure necessary to solve #646 easily.
We might want to tackle this at the same time than the various Excel API refactors (#826, #900, #926, #967, #1005).
We might want to be even more ambitious and implement something like Pandas Styler but that would take a long time until we have time to design such a large system (unless we just reuse the Pandas design -- but I am unsure it applies)
https://pandas.pydata.org/pandas-docs/stable/user_guide/style.html#Table-Visualization
Reactions are currently unavailable