from xlrd import open_workbook
workbook = open_workbook(r'suppiler_data.xlsx')
workbook.nsheets
for sheet in workbook.sheets():
print(sheet.name,sheet.nrows,sheet.ncols)
from xlrd import open_workbook
from xlwt import Workbook
# 实例化一个对象
output_workbook = Workbook()
# 为输出的工作簿加一个 sheet 名为 123 的
output_worksheet = output_workbook.add_sheet('123')
with open_workbook(r'suppiler_data.xlsx') as workbook:
# 引用此工作表中 sheet 名为 1 的
worksheet = workbook.sheet_by_name('1')
for row in range(worksheet.nrows):
for col in range(worksheet.ncols):
output_worksheet.write(row,col,worksheet.cell_value(row,col))
# 保存新的 excel
output_workbook.save(r'zjk.xlsx')