I would like to loop through an excel table and get the values for selected columns in each row in a set of lists or dictionary. if in a dictionary, for each row, the value in the first selected column would be the key and the values in the other selected columns would be the values (array) for that key. I cannot figure out how to tell python to read values from only selected columns...for the excel table may have 10 columns but I am only interest in three for example, and the three of interest are not contiguous. Would appreciate your insights using XLRD.
import xlrd
from xlrd import open_workbook
import arcpy
wb = open_workbook ("c:\\Users\\Admin\\Documents\\Marion\\Courses\\GEOG485\\FinalProject\\Data\\ExcelFiles\\Belize_Culvert_Nov15_V4.0.xlsx")
sheet = wb.sheet_by_index(1)
keys = [sheet.cell(0, 5).value for col_index in xrange(sheet.ncols)]
dict_list = []
for rownum in range(sheet.nrows):
d = {keys[col_index]: sheet.cell(0, 5).value
for col_index in xrange(sheet.ncols)}:
dict_list.append(d)
The field that I want to use as key is column 5 and the values are columns #16 and #17 as an array value for each key...