# coding:utf-8
from openpyxl import load_workbook
import openpyxl
my_excel = load_workbook("DB_train1.xlsx")#生成一个已存在的workbook对象
my_excel1 = my_excel.active#激活sheet
for i in range(7482):
my_excel1.cell(2+i,1,i+1)#往sheet中的第一列输入1-7482
for j in range(7482):
my_excel1.cell(2+j,2,7482-j-1)#往sheet中的第一列输入7482-1
my_excel.save("DB_train1.xlsx")#保存
向DB_train1.xlsx写入具体如下