How to append values in a excel sheet's column to a different list using openpyxl in python? -
from openpyxl import * wb = load_workbook('excel.xlsx') table=[] sheet_name=wb.get_sheet_by_name('input_sheet') indx_row, row in enumerate(sheet_name.iter_rows()): cell_ind,cell in enumerate(row): if indx_row==0: table.append(cell.value) print table output:['col1','col2','col3','col4']
now want crate lists names col1, col2,col3,col4
col1=[] col2=[] col3=[] col4=[]
dynamically since excel sheet changing. want append corresponding column values corresponding column lists.how can this?
openpyxl provides iter_cols()
method , columns
property columnar access.
Comments
Post a Comment