Python Excel processing OPENPYXL

Source: Internet
Author: User

#!usr/bin/dev python

From OPENPYXL import Load_workbook
Import OS
Import Os.path
File_path = ' C:/users/hugo lester/desktop/statics.xlsx '
WS = Load_workbook (File_path)
Sheet = ws.get_sheet_by_name (' Sheet1 ')
For I in Range (1,10):
CLO = str (int (i))

#sheet [' G ' +clo] = sheet.cell[' A ' +clo].value +sheet.cell[' B ' +clo].value+sheet.cell[' C ' +clo].value+sheet.cell[' D ' + clo].value+sheet.cell[' E ' +clo].value+sheet.cell[' F ' +clo].value
#+ sheet[' B ' +clo]+ sheet[' C ' +clo]+ sheet[' D ' +clo]+ sheet[' E ' +clo]+ sheet[' F ' +clo]
#sheet [' A ' + clo].value + sheet[' B ' + clo].value + sheet[' C ' + clo].value +sheet[' D ' +clo].value+sheet[' E ' +clo].value+shee t[' F ' +clo].value
sheet[' G ' + clo] = 0
For row in range (0,6):
rownum = Chr (ord (' A ') + row)
Position = rownum + CLO
Print Sheet[position].value
#print rownum
If not Sheet[position].value is None:

sheet[' G ' + clo] = sheet[' g ' + clo].value +sheet[position].value
#print rownum
#print type (ROW)
#print type (sheet[' G ' + clo].value)
#print rownum (File_path)


Python Excel processing OPENPYXL

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: 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.