The autoSizeColumn()
method does take a lot of time if there are a lot of columns to resize.
One solution to this problem is to do call the autoSizeColumn()
method for the required column only after all the rows have been created, not in each iteration.
The javadoc for this method mentions the following:
This process can be relatively slow on large sheets, so this should normally only be called once per column, at the end of your processing.