I have a very specific Excel sheet that looks like this:
I am trying to convert it to a Python dictionary like this:
item_map = {
"1609755": {
"name": "test 1",
"price": 125,
"check_type": "check 1"
},
"1609756": {
"name": "test 2",
"price": 2500,
"check_type": "check 2"
},
"1609758": {
"name": "test 3",
"price": 2400,
"check_type": "check 3"
}
}
My question is: How do I convert a excel sheet to a Python dictionary?
So far I tried using the library sheet2dict and also pandas, however in the excel sheet, the id is a key in the dictionary. As a result, I am quite stumped on how to ensure that the first column is ALWAYS set as a key.
from sheet2dict import Worksheet
ws = Worksheet()
file_path = 'test.xlsx'
x = ws.xlsx_to_dict(path = file_path)
print(x)
