openpyxl逐列添加
from openpyxl import load_workbook
workbook = load_workbook(filename='test.xlsx')
test = load_workbook(filename='test1.xlsx')
sheet = workbook.active
sheet1 = test.active
cell = sheet['A'] //读取A列
cell1 = list(cell) //把A列格式化为list格式
#sheet1.cell(row=1,column=1).value = cell.value
#sheet1.insert_cols(1)
for hang in range(len(cell)):
for shujv in cell:
h = hang + 1
sheet1.cell(row=h,column=2).value = cell1[hang].value //逐行写入
test.save('test1.xlsx')
#for column in sheet.columns:
# for cell in column:
# sheet1.append([cell.value])