import json
from collections import OrderedDict
from itertools import islice
from openpyxl import load_workbook

excelName = 'nahrwert.xlsx'
excelWorkbookName = 'Lebensmittel'
jsonName = 'fooditems.json'

wb = load_workbook(excelName)
sheet = wb[excelWorkbookName]

names_list = []

for row in islice(sheet.values, 1, sheet.max_row):
# for row in islice(sheet.values, 1, 2):
    names = OrderedDict()
    rowcounter = 0
    for col in islice(sheet.iter_cols(min_row=1, max_row=1), 0, 32):
        for cell in col:
            names[cell.value] = row[rowcounter]
            rowcounter = rowcounter+1
    names_list.append(names)

j = json.dumps(names_list)

with open(jsonName,'w') as f:
    f.write(j)
