Is there a way to fold multiple rows using openpyxl
? There doesn't appear to be a row equivalent to the example found on the openpyxl simple usage page.
import openpyxl
wb = openpyxl.Workbook(True)
ws = wb.create_sheet()
ws.column_dimensions.group('A','D', hidden=True)
wb.save('group.xlsx')
You can do it using row_dimensions.group method
from openpyxl import Workbook
wb = Workbook()
ws = wb.create_sheet()
ws.column_dimensions.group("A", "D", hidden=True)
ws.row_dimensions.group(1, 5, hidden=True)
wb.save("group.xlsx")
No, there isn't an equivalent but rows are slightly easier to deal with because they are always there, ColumnDimensions
are created on demand. Simply set the rows you want to hidden.
Eg. to hide rows 5 to 9:
for idx in range(5, 10):
ws.row_dimensions[idx].hidden = True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With