openpyxl,将数据复制并粘贴到不同工作表中的不同位置

时间:2017-06-30 19:02:45

标签: python excel openpyxl

我正在尝试复制单元格D8:G41从'Sheet1''Parent Participation by Class 2017-2018.xlsx'然后到B7:G40的'Per Class Report''AF17参与报告2017-6-14'

这是我的代码,包含所有松散的结尾:

from openpyxl import Workbook, load_workbook


wb_raw_data = load_workbook(filename = 'Parent Participation by Class 2017-2018.xlsx')

sheet1 = wb_raw_data.get_sheet_by_name('Sheet1')

wb_to_change_data = load_workbook(filename = 'AF17 Participation Report 2017-6-14.xlsx')

sheet2 = wb_to_change_data.get_sheet_by_name('Per Class Report')


for row_num_copy in range(8,41):    #iterate through the rows
    for col_num_copy in range(4,6): #iterate through col_num


# need to be pasted to 'AF17 Participation Report 2017-6-14.xlsx'
#                                               for row_num_paste in range(2,4):
#                                                   for col_num_past in range(7,40):



wb_to_change_data.save('AF17 Participation Report 2017-6-14.xlsx')

0 个答案:

没有答案