读取操作
import xlrdexcel_path=r'/Users/dd/Desktop/login.xlsx'workbook=xlrd.open_workbook(excel_path,formatting_info=True)print(workbook.sheet_names())worksheet=workbook.sheet_by_name('登录')rows=worksheet.row_values(1)clos=worksheet.col_values(1)celldata=worksheet.cell(1,2).valueprint(type(celldata))print(worksheet.cell(1,2).ctype)
写入操作
import xlutilsfrom xlutils.copyimport copyworkbook_wt=copy(workbook)wtsheet=workbook_wt.get_sheet(0)wtsheet.write(one,7,json.dumps(add_veneto1))wtsheet.write(one, 8, excel_res)workbook_wt.save(r'/Users/dd/Desktop/login2.xlsx')