需求背景
表1有两列
表2包含表1不过缺少坐标字段
需要根据HID匹配两个表,把表1的坐标内容补充到表2
代码
import shutil
import sys
import xlwt
import xlrd
file1 = "C:\\Users\\xuyin\\Desktop\\新建文件夹\\match-excel\\表1.xls"
#打开表1
wb1 = xlrd.open_workbook(filename=file1)
# 表1要匹配的列索引
hid_index1 = 0
# 表1目标数据列索引
target_index1 = 1
# 表1的sheet
sheet1 = wb1.sheet_by_index(0)
# 表1的sheet的总行数
rowNum1 = sheet1.nrows
# 表1的sheet的总列数
colNum1 = sheet1.ncols
file2 = "C:\\Users\\xuyin\\Desktop\\新建文件夹\\match-excel\\表2.xls"
#打开表2
wb2 = xlrd.open_workbook(filename=file2)#打开文件
# 表2要匹配的列索引
hid_index2 = 0
# 表2目标数据列索引
targ