How to read merged cells in python using openpyxl?
问题 I'm trying to read data from the excel file that has merged_cells_range... but the output is not my goal. Pls help me out import openpyxl wb = openpyxl.load_workbook('book1.xlsx') sheet = wb.get_sheet_by_name('info') all_data=[] print(sheet.merged_cells.ranges) for row_index in range(1,sheet.max_row+1): row=[] for col_index in range(1,sheet.max_column+1): vals = sheet.cell(row_index,col_index).value if vals =='': for crange in sheet.merged_cells.ranges: rlo,rhi,clo,chi = crange if rlo<=row