from win32com.client import Dispatch
excel = Dispatch('Excel.Application')
wb = excel.Workbooks.Open('D:\\output.xlsx')
excel.Worksheets(2).Activate()
excel.ActiveSheet.Columns.AutoFit()
wb.SaveAs('D:\\output_fit.xlsx')
wb.Close()
Using Python To Autofit All Columns of an Excel Sheet