I'm getting lost of using worksheet.set_column all the time. Is there any possibility of setting the width of all columns automatically?
What would be the Python function that simulates it? (using only xlsxwriter library):
def autofit(filename, worksheet_name):
# ???
Is there any possibility of setting the width of all columns automatically?
Unfortunately, not.
From the XlsxWriter FAQ:
Q. Is there an "AutoFit" option for columns?
Unfortunately, there is no way to specify "AutoFit" for a column in the Excel file format. This feature is only available at runtime from within Excel. It is possible to simulate "AutoFit" in your application by tracking the maximum width of the data in the column as your write it and then adjusting the column width at the end.
所有评论(0)