from openpyxl import *
Variable_Model_Path=defaultdict(list)
Sheet_Name=wb.get_sheet_by_name(Sheet)
for row in Sheet_Name.iter_rows():
Row=[cell.value for cell in row]
for cell_ind,cell in enumerate(Row):
print cell
Above is my sample code.
I have an excel sheet which have headers var1, var2 ,var3. I want to create a dictionary {Var1:1,4,7,10} Where Var1 would be header name and the values would be corresponding column values. I am using openpyxl module.Here variable names and values would be given by the user and they will be dynamic.
Var1 Var2 Var3
- 1 2 3
- 4 5 6
- 7 8 9
- 10 11 12