df = pd.DataFrame(data=valuesDict,index=[0])

    # Create a Pandas Excel writer using XlsxWriter as the engine.
    writer = pd.ExcelWriter(os.path.join(ios_inspection_excel_file, file[:-4]) + '.xlsx', engine='xlsxwriter')
    # Convert the dataframe to an XlsxWriter Excel object.
    df.to_excel(writer, sheet_name='Sheet1')
    # Get the xlsxwriter worksheet object.
    worksheet = writer.sheets['Sheet1']
    # Set the column width and format.
    worksheet.set_column("B:Z", 25) # 在这里更改宽度值
    # Close the Pandas Excel writer and output the Excel file.
    writer.save()

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注