app xw.App(visible True, add_book False)
file_path C:\Users\Administrator\Desktop\测试\来源
file_list os.listdir(file_path)
# sheet_name sheet1
for i in file_list:
if os.path.splitext(i)[1] .xlsx :
if i.startswith( ~$ ):
continue
file_paths os.path.join(file_path, i)
wb app.books.open(file_paths)
cont wb.sheets[0].range( A10 ).current_region.value
print(cont)
new_name C:\Users\Administrator\Desktop\测试\统计表.xlsx
nb app.books.open(new_name)
scope nb.sheets[0].range( A1 ).expand()
nb.sheets[0].range(scope.shape[0] 1, 1).value cont
time.sleep(10)
nb.save()
nb.close()
wb.close()
app.quit()
有BUG A列有不能有空 有空会受影响