Python Excel table Operations

Source: Internet
Author: User

# coding:utf-8#==================================================================================
# Author:changbo-email:[email protected]#Last modified:2017-4-8#filename:run_status.py#description:create File 952700000ach5q05 operation, Base Xlswriter
# Blog:http://www.cnblogs.com/changbo#==================================================================================import Xlsxwriterimport Timenowtime = Time.strftime ('%y-%m-%d ', Time.localtime (Time.time ())) Nowtime1 = (time.strftime (' _%y_%m_%d ', Time.localtime (Time.time ())). Strip () file_name = U ' 952700000ach5q05 operating condition%s.xlsx '% nowtime1title = [u ' PIR alarm number ', U ' Wan wake-up Times ', U ' wake on LAN ', U ' Codec total duration ', U ' Codec duration (color) ', U ' Codec duration (black and white) ', U ' Codec continuous run time (alarm) ', U ' Codec Duration (preview) ', u ' soft restart count ', U ' hard restart count ', u ']title1 = [u ' the day ', U ' last one months ']def titlename (): # Create File workbook = Xlsxwriter. Workbook (file_name) Merge_format = Workbook.add_format ({' bold ': True, ' align ': ' Center ', ' valign ') : ' Vcenter ',}) # Create sheet worksheet = Workbook.add_worksheet () worksheet.set_column (0, +) workshe Et.merge_range (0, 0, 1, 0, u ' date ', Merge_format) worksheet.merge_range (0, 1, 1, 1, U ' current version (latest? ) ', Merge_format) worksheet.write (' A3 ', nowtime) x =-1 for i in range (67, 87, 2): Toptitle = '%s1:%s1 '% (Chr (i), Chr (i + 1)) Secondtitle = '%s2 '% chr (i) secondtitle2 = '%s2 '% chr (i + 1) x + = 1 Worksheet.merge_range (toptitle, title[x], Merge_format) worksheet.write (secondtitle, Tit Le1[0], Merge_format) worksheet.write (Secondtitle2, title1[1], Merge_format) worksheet.merge_range (' W1:w2 ', U ' the same day AP drop-off times ', Merge_format) worksheet.merge_range (' X1:aa1 ', U ' Power Information ', Merge_format) worksheet.write (' X2 ', u ' installation case ', Merge_f ormat) worksheet.write (' Y2 ', u ' battery type ', Merge_format) worksheet.write (' Z2 ', U ' supply case ', Merge_format) Worksheet.write ( ' AA2 ', U ' remaining power ', Merge_format) worksheet.merge_range (' Ab1:ab2 ', U ' codec the number of crashes ', Merge_format) workbook.close () retur nif __name__ = = ' __main__ ': TitleName ()

end!

Python Excel table Operations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.