@Kushan Or you can use resizeColumnsToContents() method for the same.