Openpyxl auto-height row

APatrikMs94 picture APatrikMs94 · Jun 18, 2016 · Viewed 12.7k times · Source

I'm trying to set wrap text. But when i using wrap text row doesn't change height automatically. How can I set auto-height row?

Answer

Charlie Clark picture Charlie Clark · Jun 18, 2016

You need to look at the RowDimension object for the relevant row, specifically the height attribute:

rd = ws.row_dimensions[3] # get dimension for row 3
rd.height = 25 # value in points, there is no "auto"