Python xlsxwriter, change row height for all rows in the sheet, following is available but apply to single row
worksheet.set_row(0, 20) # Set the height of Row 1 to 20.
Want to change height of all the rows sheet.
Advertisement
Answer
To set the height of all rows in XlsxWriter, efficiently*, you can use the set_default_row()
method:
worksheet.set_default_row(20)
(*) This is efficient because it uses an Excel optimisation to adjust the row heights with a single XML element. By contrast, using set_row()
for each of the ~ 1 million rows would required 1 million XML elements and would lead to a very large file.