In [4]:
import xlrd
import xlsxwriter
wbRD = xlrd.open_workbook('DD_Summary_Basic.xlsx') sheets = wbRD.sheets()
workbook = xlsxwriter.Workbook(result_xlsx)
for sheet in sheets: # write data from old file newSheet = workbook.add_worksheet(sheet.name) for row in range(sheet.nrows): for col in range(sheet.ncols): newSheet.write(row, col, sheet.cell(row, col).value)
In [24]:
wbRD_col2 = xlrd.open_workbook('C:/Users/mrbon/Google Диск/Диссертация/Расчеты/Парафины 5-8/DD_09.11.2017/DD_col_2.xlsx')
sheets = wbRD_col2.sheets()
workbook = xlsxwriter.Workbook('C:/Users/mrbon/Google Диск/Диссертация/Расчеты/Парафины 5-8/DD_09.11.2017/summary_DD_col_2.xlsx')
sum_sheet = workbook.add_worksheet('Summary')
for col in range(0 ,8):
sum_sheet.write(0, col, sheets[0].cell(0, col).value)
for col in range(0, 8):
new_row = 1
for row in range(1, sheets[0].nrows, 4):
sum_sheet.write(new_row, col, sheets[0].cell(row, col).value)
sum_sheet.write(new_row + 1, col, sheets[0].cell(row + 1, col).value)
sum_sheet.write(new_row + 2, col, sheets[0].cell(row + 2, col).value)
sum_sheet.write(new_row + 3, col, sheets[0].cell(row + 3, col).value)
new_row += 5
new_row_2 = 5
for row in range(1, sheets[1].nrows):
sum_sheet.write(new_row_2, col, sheets[1].cell(row, col).value)
new_row_2 += 5
workbook.close()
In [ ]:
In [ ]: