import os
from openpyxl import *

def read(filepath):
    def read_datasheet(workbook):
        #reset lists
        k=[]
        m=[]

        workbook = load_workbook(filepath, data_only=True)

        datasheet = workbook["Data sheet"]

        version = datasheet.cell(row=1, column=1).value

        #max index
        max = 72

        if version == "V23.01":
            for i in range(max):
                k.append(0)
                m.append(0)

        results["version_datasheet"] = version
        results["general data"] = {}
        results["product details"] = {}
        results["paper based material data"] = {}
        results["functional application out"] = {}
        results["functional application in"] = {}
        results["functional application mid"] = {}
        results["printing"] = {}
        results["varnish"] = {}
        results["glue"] = {}
        results["sealing"] = {}
        results["non paper based"] = {}
        results["other remarks"] = {}
        results["date of production"] = {}
        results["barrier perfomance out"] = {}
        results["barrier perfomance in"] = {}
        results["compostability and biodegradability"] = {}


        results["general data"]["company name"] = cell(datasheet, 4, 6, 0)
        results["general data"]["product name"] = cell(datasheet, 5, 6, 1)
        results["general data"]["desription"] = cell(datasheet, 6, 6, 2)
        results["general data"]["material/product"] = cell(datasheet, 7, 6, 3)

        results["product details"]["width and tolerance"] = cell(datasheet, 10, 6, 4)
        results["product details"]["length and tolerance"] = cell(datasheet, 11, 6, 5)
        results["product details"]["height and tolerance"] = cell(datasheet, 12, 6, 6)
        results["product details"]["weight of product"] = cell(datasheet, 13, 6, 7)
        results["product details"]["is it a used product"] = cell(datasheet, 14, 6, 8)

        results["paper based material data"]["base material"] = cell(datasheet, 17, 6, 9)
        results["paper based material data"]["grammage"] = cell(datasheet, 18, 6, 10)
        results["paper based material data"]["thickness"] = cell(datasheet, 19, 6, 11)
        results["paper based material data"]["pigments"] = cell(datasheet, 20, 6, 12)
        results["paper based material data"]["fillers"] = cell(datasheet, 21, 6, 13)
        results["paper based material data"]["wet streght polymers"] = cell(datasheet, 22, 6, 14)
        results["paper based material data"]["artificial fibres"] = cell(datasheet, 23, 6, 15)
        results["paper based material data"]["printed, varnished, lacquered,..."] = cell(datasheet, 24, 6, 16)
        results["paper based material data"]["printing"] = cell(datasheet, 25, 6, 17)
        results["paper based material data"]["varnish"] = cell(datasheet, 26, 6, 18)
        results["paper based material data"]["adhesive"] = cell(datasheet, 27, 6, 19)
        results["paper based material data"]["additional sealing"] = cell(datasheet, 28, 6, 20)
        results["paper based material data"]["functional app out"] = cell(datasheet, 29, 6, 21)
        results["paper based material data"]["functional app in"] = cell(datasheet, 30, 6, 22)
        results["paper based material data"]["functional app mid"] = cell(datasheet, 31, 6, 23)
        results["paper based material data"]["addtional information"] = cell(datasheet, 32, 6, 23)

        results["functional application out"]["description"] = cell(datasheet, 34, 6, 24)
        results["functional application out"]["grammage"] = cell(datasheet, 35, 6, 25)
        results["functional application out"]["thickness"] = cell(datasheet, 36, 6, 26)
        results["functional application out"]["related area"] = cell(datasheet, 37, 6, 27)

        results["functional application in"]["description"] = cell(datasheet, 40, 6, 28)
        results["functional application in"]["grammage"] = cell(datasheet, 41, 6, 29)
        results["functional application in"]["thickness"] = cell(datasheet, 42, 6, 30)
        results["functional application in"]["related area"] = cell(datasheet, 43, 6, 31)

        results["functional application mid"]["description"] = cell(datasheet, 46, 6, 32)
        results["functional application mid"]["grammage"] = cell(datasheet, 47, 6, 33)
        results["functional application mid"]["thickness"] = cell(datasheet, 48, 6, 34)
        results["functional application mid"]["related area"] = cell(datasheet, 49, 6, 35)

        results["functional application mid"]["overall grammage"] = cell(datasheet, 51, 6, 36)
        results["functional application mid"]["overall thickness"] = cell(datasheet, 52, 6, 37)
        results["functional application mid"]["additional specs"] = cell(datasheet, 53, 6, 38)

        results["printing"]["type description"] = cell(datasheet, 56, 6, 39)
        results["printing"]["weight"] = cell(datasheet, 57, 6, 40)
        results["printing"]["printing area"] = cell(datasheet, 58, 6, 41)

        results["varnish"]["type description"] = cell(datasheet, 61, 6, 42)
        results["varnish"]["weight"] = cell(datasheet, 62, 6, 43)
        results["varnish"]["varnish area"] = cell(datasheet, 63, 6, 44)

        results["glue"]["type description"] = cell(datasheet, 66, 6, 45)
        results["glue"]["use description"] = cell(datasheet, 67, 6, 46)
        results["glue"]["weight"] = cell(datasheet, 68, 6, 47)

        results["sealing"]["type description"] = cell(datasheet, 71, 6, 48)
        results["sealing"]["weight"] = cell(datasheet, 72, 6, 49)
        results["sealing"]["sealing"] = cell(datasheet, 73, 6, 50)

        results["non paper based"]["description"] = cell(datasheet, 76, 6, 51)
        results["non paper based"]["weight"] = cell(datasheet, 77, 6, 52)
        results["non paper based"]["removability"] = cell(datasheet, 78, 6, 53)

        results["other remarks"]["other remarks"] = cell(datasheet, 81, 6, 54)

        results["date of production"]["date of production"] = cell(datasheet, 84, 6, 55)

        results["barrier perfomance out"]["otr"] = cell(datasheet, 87, 6, 56)
        results["barrier perfomance out"]["wvtr"] = cell(datasheet, 88, 6, 57)
        results["barrier perfomance out"]["grease/oil/fat"] = cell(datasheet, 89, 6, 58)
        results["barrier perfomance out"]["mosh/moah"] = cell(datasheet, 90, 6, 59)
        results["barrier perfomance out"]["water barrier"] = cell(datasheet, 91, 6, 60)
        results["barrier perfomance out"]["nature of coating"] = cell(datasheet, 92, 6, 61)

        results["barrier perfomance in"]["otr"] = cell(datasheet, 95, 6, 62)
        results["barrier perfomance in"]["wvtr"] = cell(datasheet, 96, 6, 63)
        results["barrier perfomance in"]["grease/oil/fat"] = cell(datasheet, 97, 6, 64)
        results["barrier perfomance in"]["mosh/moah"] = cell(datasheet, 98, 6, 65)
        results["barrier perfomance in"]["water barrier"] = cell(datasheet, 99, 6, 66)
        results["barrier perfomance in"]["nature of coating"] = cell(datasheet, 100, 6, 67)

        results["compostability and biodegradability"]["compost"] = cell(datasheet, 103, 6, 68)
        results["compostability and biodegradability"]["home compost"] = cell(datasheet, 104, 6, 69)
        results["compostability and biodegradability"]["biodeg aqua"] = cell(datasheet, 105, 6, 70)
        results["compostability and biodegradability"]["biodeg soil"] = cell(datasheet, 106, 6, 71)

    def cell(worksheet, row, column, index):
        return str(worksheet.cell(row=row + k[index], column=column + m[index]).value)

    def versioncheck(workbook):
        ubersicht = workbook["Übersicht"]
        columnb = []

        for cell in ubersicht["B"]:
            columnb.append(cell.value)
        #clean list
        version = []
        for i in columnb:
            if i is not None:
                version.append(i)

        return version[-1]

    results = {}
    if filepath.endswith('.xlsx'):  # sicherstellen, dass es sich um eine Excel-Datei handelt
        #load Excelfile from path
        workbook = load_workbook(filepath, data_only=True)

        #lil thingi so it doesn't crash
        if "Übersicht" in workbook.sheetnames and "Nasslaborteil" in workbook.sheetnames and "Blattklebetest" in workbook.sheetnames and "visuelle Beurteilung" in workbook.sheetnames:
            print(filepath + " vollständig")
        else:
            #avoid crashing due to wrong .xlsx
            return results

        version = versioncheck(workbook)
        print(version)
        max_index = 126
        k = []
        m = []

        def shift_ars2(k,m):
            m[62] = 10
            m[63] = 10
            m[64] = 10
            m[65] = -1
            m[66] = -1
            m[67] = -1
            m[68] = 10
            m[69] = 10
            m[69] = 10

        def shift_pH_lf(k,m):
            m[71] = 10
            m[72] = 10
            m[73] = 10
            m[74] = 10

        #corrects the k and m lists so it matches the bkt and vb of the cepi sheets < V22.8
        def correct_bkt_vb_old(k,m):
            for i in range(107, 113):
                k.append(0)
                m.append(0)
            k[108] = 5
            k[111] = 5
            k[109] = 5
            k[112] = 5
            for i in range(113, 119):
                k.append(5)
                m.append(0)
            k[114] = 10
            k[115] = 10
            k[117] = 10
            k[118] = 10

            #vb
            for i in range(119, max_index+1):
                k.append(0)
                m.append(0)
            k[120] = -4
            k[122] = -4
            k[123] = -1
            k[125] = -1
            k[124] = -5
            k[126] = -5
            m[121] = -1
            m[122] = -1
            m[125] = -1
            m[126] = -1

        if version == "V22.1" or version == "V22.2" or version == "V22.3":
            for i in range(0, 62):
                #normal till ARS 2
                k.append(0)
                m.append(0)
            for i in range (62, 75):
                #shift ARS 2 to 4 to the side so it gets blank
                k.append(0)
                m.append(50)
            for i in range(75, 93):
                k.append(-3)
                m.append(0)
            for i in range(93, 96):
                k.append(-1)
                m.append(0)
            for i in range(96, 107):
                k.append(-2)
                m.append(0)
            correct_bkt_vb_old(k,m)

            #verified

        elif version == "V22.6":
            for i in range(0, 75):
                k.append(0)
                m.append(0)

            shift_ars2(k,m)
            shift_pH_lf(k,m)

            for i in range(75,93):
                k.append(-4)
                m.append(0)

            for i in range(93,107):
                k.append(-2)
                m.append(0)
            correct_bkt_vb_old(k,m)

            #verified

        elif version == "V22.7":
            for i in range(0, 107):
                k.append(0)
                m.append(0)

            for i in range(75, 93):
                k[i] = -2

            m[62] = 10
            m[63] = 10
            m[64] = 10
            m[65] = -1
            m[66] = -1
            m[67] = -1
            correct_bkt_vb_old(k,m)

            #verfied

        elif version == "V22.8" or version == "V22.9":
            for i in range(0, max_index+1):
                k.append(0)
                m.append(0)

            #shift ARS
            m[62] = 10
            m[63] = 10
            m[64] = 10
            m[65] = -1
            m[66] = -1
            m[67] = -1

            for i in range(75, 93):
                k[i] = -2

            #verified

        elif version =="V23.02" or version == "V23.04" or version == "V23.05":
            for i in range(0, max_index+1):
                k.append(0)
                m.append(0)

            for i in range(75, 93):
                k[i] = -1

            for i in range(71, 75):
                k[i] = 1

            for i in range(93, 107):
                k[i] = 1

            m[73] = 1
            m[74] = 1

            #verified

        elif version == "V23.07":
            print("23.07 needs extra testing")
            return results

        #If version not supported
        else:
            version = ""
            print("Version nicht unterstützt")
            return results


        #load all sheets
        ubersicht = workbook["Übersicht"]
        nasslabor = workbook["Nasslaborteil"]
        blattklebetest = workbook["Blattklebetest"]
        visual = workbook["visuelle Beurteilung"]

        #create keys
        results["version"] = {}
        results["übersicht"] = {}
        results["nasslaborteil"] = {}
        results["nasslaborteil_grob"] = {}
        results["nasslaborteil_fein"] = {}
        results["blattklebetest"] = {}
        results["visuelle beurteilung"] = {}

        #start the read
        results["version"]["version"] = version
        #first page
        results["übersicht"]["probeneingang_datum"] = cell(ubersicht, 3, 3, 0)
        results["übersicht"]["probeneingang_name"] = cell(ubersicht, 3, 4, 1)
        results["übersicht"]["probenvorbereitung_datum"] = cell(ubersicht, 4, 3, 2)
        results["übersicht"]["probenvorbereitung_name"] = cell(ubersicht, 4, 4, 3)
        results["übersicht"]["probenuntersuchung_datum"] = cell(ubersicht, 6, 3, 4)
        results["übersicht"]["probenuntersuchung_name"] = cell(ubersicht, 6, 4, 5)
        results["übersicht"]["auftrag"] = cell(ubersicht, 8, 3, 6)
        results["übersicht"]["labornummer"] = cell(ubersicht, 7, 3, 7)
        results["übersicht"]["firma"] = cell(ubersicht, 9, 3, 8)
        prob_nr = ubersicht.cell(row=10, column=3).value
        prob_bez = ubersicht.cell(row=10, column=4).value
        if prob_nr == None:
            prob_nr = " "
        if prob_bez == None:
            prob_bez = " "
        results["übersicht"]["bezeichnung"] = prob_nr + " | " + prob_bez

        #second page
        results["nasslaborteil"]["bestandteil_1"] = cell(nasslabor, 15, 2, 10)
        results["nasslaborteil"]["bestandteil_2"] = cell(nasslabor, 16, 2, 11)
        results["nasslaborteil"]["bestandteil_3"] = cell(nasslabor, 17, 2, 12)
        results["nasslaborteil"]["bestandteil_4"] = cell(nasslabor, 18, 2, 13)
        results["nasslaborteil"]["bestandteil_5"] = cell(nasslabor, 19, 2, 14)
        results["nasslaborteil"]["bestandteil_6"] = cell(nasslabor, 20, 2, 15)
        results["nasslaborteil"]["bestandteil_7"] = cell(nasslabor, 21, 2, 16)
        results["nasslaborteil"]["bestandteil_8"] = cell(nasslabor, 22, 2, 17)
        #nicht schön aber selten
        results["nasslaborteil"]["masse_1"] = cell(nasslabor, 15, 4, 18)
        results["nasslaborteil"]["masse_2"] = cell(nasslabor, 16, 4, 19)
        results["nasslaborteil"]["masse_3"] = cell(nasslabor, 17, 4, 20)
        results["nasslaborteil"]["masse_4"] = cell(nasslabor, 18, 4, 21)
        results["nasslaborteil"]["masse_5"] = cell(nasslabor, 19, 4, 22)
        results["nasslaborteil"]["masse_6"] = cell(nasslabor, 20, 4, 23)
        results["nasslaborteil"]["masse_7"] = cell(nasslabor, 21, 4, 24)
        results["nasslaborteil"]["masse_8"] = cell(nasslabor, 22, 4, 25)

        results["nasslaborteil"]["trocken_entfernt_1"] = cell(nasslabor, 15, 6, 26)
        results["nasslaborteil"]["trocken_entfernt_2"] = cell(nasslabor, 16, 6, 27)
        results["nasslaborteil"]["trocken_entfernt_3"] = cell(nasslabor, 17, 6, 28)
        results["nasslaborteil"]["trocken_entfernt_4"] = cell(nasslabor, 18, 6, 29)
        results["nasslaborteil"]["trocken_entfernt_5"] = cell(nasslabor, 19, 6, 30)
        results["nasslaborteil"]["trocken_entfernt_6"] = cell(nasslabor, 20, 6, 31)
        results["nasslaborteil"]["trocken_entfernt_7"] = cell(nasslabor, 21, 6, 32)
        results["nasslaborteil"]["trocken_entfernt_8"] = cell(nasslabor, 22, 6, 33)

        results["nasslaborteil"]["tg_1_1"] = cell(nasslabor, 29, 3, 34)
        results["nasslaborteil"]["tg_1_2"] = cell(nasslabor, 30, 3, 35)
        results["nasslaborteil"]["tg_1_3"] = cell(nasslabor, 31, 3, 36)
        results["nasslaborteil"]["tg_1_4"] = cell(nasslabor, 32, 3, 37)
        results["nasslaborteil"]["tg_1_5"] = cell(nasslabor, 33, 3, 38)
        results["nasslaborteil"]["tg_1_6"] = cell(nasslabor, 34, 3, 39)
        results["nasslaborteil"]["tg_1_7"] = cell(nasslabor, 35, 3, 40)
        results["nasslaborteil"]["tg_1_8"] = cell(nasslabor, 36, 3, 41)

        results["nasslaborteil"]["tg_2_1"] = cell(nasslabor, 29, 4, 42)
        results["nasslaborteil"]["tg_2_2"] = cell(nasslabor, 30, 4, 43)
        results["nasslaborteil"]["tg_2_3"] = cell(nasslabor, 31, 4, 44)
        results["nasslaborteil"]["tg_2_4"] = cell(nasslabor, 32, 4, 45)
        results["nasslaborteil"]["tg_2_5"] = cell(nasslabor, 33, 4, 46)
        results["nasslaborteil"]["tg_2_6"] = cell(nasslabor, 34, 4, 47)
        results["nasslaborteil"]["tg_2_7"] = cell(nasslabor, 35, 4, 48)
        results["nasslaborteil"]["tg_2_8"] = cell(nasslabor, 36, 4, 49)

        results["nasslaborteil"]["einwaage"] = cell(nasslabor, 23, 8, 50)

        results["nasslaborteil"]["gerätetyp"] = cell(nasslabor, 41, 3, 51)
        results["nasslaborteil"]["labor"] = cell(nasslabor, 42, 3, 52)
        results["nasslaborteil"]["zerfaserungsdauer"] = cell(nasslabor, 43, 3, 53)
        results["nasslaborteil"]["umdrehungen"] = cell(nasslabor, 44, 3, 54)
        results["nasslaborteil"]["bemerkung"] = cell(nasslabor, 45, 3, 55)

        results["nasslaborteil"]["csb_verdünnung"] = cell(nasslabor, 59, 4, 56)
        results["nasslaborteil"]["csb_messbereich"] = cell(nasslabor, 60, 4, 57)
        results["nasslaborteil"]["csb_messwert"] = cell(nasslabor, 61, 4, 58)

        results["nasslaborteil"]["ars_filtrat1_einwaage"] = cell(nasslabor, 70, 3, 59)
        results["nasslaborteil"]["ars_filtrat1_masse_schale"] = cell(nasslabor, 71, 3, 60)
        results["nasslaborteil"]["ars_filtrat1_auswaage"] = cell(nasslabor, 72, 3, 61)

        results["nasslaborteil"]["ars_filtrat2_einwaage"] = cell(nasslabor, 70, 4, 62)
        results["nasslaborteil"]["ars_filtrat2_masse_schale"] = cell(nasslabor, 71, 4, 63)
        results["nasslaborteil"]["ars_filtrat2_auswaage"] = cell(nasslabor, 72, 4, 64)

        results["nasslaborteil"]["ars_wasser1_einwaage"] = cell(nasslabor, 70, 5, 65)
        results["nasslaborteil"]["ars_wasser1_masse_schale"] = cell(nasslabor, 71, 5, 66)
        results["nasslaborteil"]["ars_wasser1_auswaage"] = cell(nasslabor, 72, 5, 67)

        results["nasslaborteil"]["ars_wasser2_einwaage"] = cell(nasslabor, 70, 6, 68)
        results["nasslaborteil"]["ars_wasser2_masse_schale"] = cell(nasslabor, 71, 6, 69)
        results["nasslaborteil"]["ars_wasser2_auswaage"] = cell(nasslabor, 72, 6, 70)

        results["nasslaborteil"]["ph_filtrat"] = cell(nasslabor, 77, 3, 71)
        results["nasslaborteil"]["lf_filtrat"] = cell(nasslabor, 78, 3, 72)
        results["nasslaborteil"]["ph_wasser"] = cell(nasslabor, 77, 4, 73)
        results["nasslaborteil"]["lf_wasser"] = cell(nasslabor, 78, 4, 74)

        results["nasslaborteil_grob"]["labor"] = cell(nasslabor, 87, 3, 75)

        results["nasslaborteil_grob"]["reject_filtergewicht_grob"] = cell(nasslabor, 99, 3, 76)
        results["nasslaborteil_grob"]["reject_auswaage_grob"] = cell(nasslabor, 100, 3, 77)

        results["nasslaborteil_grob"]["faser-stippen-rückstand"] = cell(nasslabor, 108, 3, 78)
        results["nasslaborteil_grob"]["faser-stippen-rückstand_art-größe"] = cell(nasslabor, 109, 3, 79)
        results["nasslaborteil_grob"]["papierfremde-bestandteile"] = cell(nasslabor, 111, 3, 80)
        results["nasslaborteil_grob"]["papierfremde-art-größe"] = cell(nasslabor, 112, 3, 81)
        results["nasslaborteil_grob"]["papierfremde-zerkleinerung"] = cell(nasslabor, 113, 3, 82)
        results["nasslaborteil_grob"]["papierfremde-material"] = cell(nasslabor, 114, 3, 83)

        results["nasslaborteil_grob"]["sd_filterblatt"] = cell(nasslabor, 117, 3, 84)
        results["nasslaborteil_grob"]["sd_einwaage"] = cell(nasslabor, 118, 3, 85)
        results["nasslaborteil_grob"]["sd_auswaage"] = cell(nasslabor, 119, 3, 86)
        results["nasslaborteil_grob"]["sd_auswaage_ts"] = cell(nasslabor, 126, 3, 87)

        results["nasslaborteil_grob"]["volumen_ac1"] = cell(nasslabor, 131, 3, 88)
        results["nasslaborteil_grob"]["grammatur_ac1"] = cell(nasslabor, 131, 4, 89)
        results["nasslaborteil_grob"]["grammatur_ac2"] = cell(nasslabor, 132, 4, 90)
        results["nasslaborteil_grob"]["grammatur_ac3"] = cell(nasslabor, 133, 4, 91)
        results["nasslaborteil_grob"]["grammatur_ac4"] = cell(nasslabor, 134, 4, 92)

        results["nasslaborteil_fein"]["labor"] = cell(nasslabor, 143, 3, 93)
        results["nasslaborteil_fein"]["reject_filtergewicht_fein"] = cell(nasslabor, 155, 3, 94)
        results["nasslaborteil_fein"]["reject_auswaage_fein"] = cell(nasslabor, 156, 3, 95)

        results["nasslaborteil_fein"]["faser-stippen-rückstand"] = cell(nasslabor, 163, 3, 96)
        results["nasslaborteil_fein"]["faser-stippen-rückstand_art-größe"] = cell(nasslabor, 164, 3, 97)
        results["nasslaborteil_fein"]["papierfremde-bestandteile"] = cell(nasslabor, 166, 3, 98)
        results["nasslaborteil_fein"]["papierfremde-art-größe"] = cell(nasslabor, 167, 3, 99)
        results["nasslaborteil_fein"]["papierfremde-zerkleinerung"] = cell(nasslabor, 168, 3, 100)
        results["nasslaborteil_fein"]["papierfremde-material"] = cell(nasslabor, 169, 3, 101)

        results["nasslaborteil_fein"]["volumen_af1"] = cell(nasslabor, 172, 3, 102)
        results["nasslaborteil_fein"]["grammatur_af1"] = cell(nasslabor, 172, 4, 103)
        results["nasslaborteil_fein"]["grammatur_af2"] = cell(nasslabor, 173, 4, 104)
        results["nasslaborteil_fein"]["grammatur_af3"] = cell(nasslabor, 174, 4, 105)
        results["nasslaborteil_fein"]["grammatur_af4"] = cell(nasslabor, 175, 4, 106)

        results["blattklebetest"]["bewertung_grob_1_prüfer"] = cell(blattklebetest, 11, 3, 107)
        results["blattklebetest"]["bewertung_grob_1_bewertung"] = cell(blattklebetest, 17, 3, 108)
        results["blattklebetest"]["bewertung_grob_1_bemerkung"] = cell(blattklebetest, 18, 3, 109)
        results["blattklebetest"]["bewertung_grob_ges_prüfer"] = cell(blattklebetest, 11, 5, 110)
        results["blattklebetest"]["bewertung_grob_ges_bewertung"] = cell(blattklebetest, 17, 5, 111)
        results["blattklebetest"]["bewertung_grob_ges_bemerkung"] = cell(blattklebetest, 18, 5, 112)

        results["blattklebetest"]["bewertung_fein_1_prüfer"] = cell(blattklebetest, 21, 3, 113)
        results["blattklebetest"]["bewertung_fein_1_bewertung"] = cell(blattklebetest, 27, 3, 114)
        results["blattklebetest"]["bewertung_fein_1_bemerkung"] = cell(blattklebetest, 28, 3, 115)
        results["blattklebetest"]["bewertung_fein_ges_prüfer"] = cell(blattklebetest, 21, 5, 116)
        results["blattklebetest"]["bewertung_fein_ges_bewertung"] = cell(blattklebetest, 27, 5, 117)
        results["blattklebetest"]["bewertung_fein_ges_bemerkung"] = cell(blattklebetest, 28, 5, 118)

        results["visuelle beurteilung"]["bewertung_grob_1_prüfer"] = cell(visual, 11, 3, 119)
        results["visuelle beurteilung"]["bewertung_grob_1_bewertung"] = cell(visual, 20, 3, 120)
        results["visuelle beurteilung"]["bewertung_grob_ges_prüfer"] = cell(visual, 11, 6, 121)
        results["visuelle beurteilung"]["bewertung_grob_ges_bewertung"] = cell(visual, 20, 6, 122)

        results["visuelle beurteilung"]["bewertung_fein_1_prüfer"] = cell(visual, 23, 3, 123)
        results["visuelle beurteilung"]["bewertung_fein_1_bewertung"] = cell(visual, 32, 3, 124)
        results["visuelle beurteilung"]["bewertung_fein_ges_prüfer"] = cell(visual, 23, 6, 125)
        results["visuelle beurteilung"]["bewertung_fein_ges_bewertung"] = cell(visual, 32, 6, 126)

        #insert dummy values for pH & lf for older versions
        if version == "V22.1" or version == "V22.2" or version == "V22.3" or version == "V22.6":
            results["nasslaborteil"]["ph_filtrat"] = 0
            results["nasslaborteil"]["lf_filtrat"] = 0
            results["nasslaborteil"]["ph_wasser"] = 0
            results["nasslaborteil"]["lf_wasser"] = 0

        #TODO csb dummy value ergänzen

        if workbook["Data sheet"]:
            #only uncommend for testing reasons or if it got implemented into the database
            read_datasheet(workbook)

    return results

def read_all(path):
    data = []
    for filename in os.listdir(path):
        data.append(read(path+filename))
    return data

def sheet_test(path):
    list = read(path)
    for value in list["übersicht"].values():
        if value != "true":
            print("Error Übersicht!")
    for value in list["nasslaborteil"].values():
        if value != "true":
            print("Error Nasslaborteil!")
    for value in list["nasslaborteil_grob"].values():
        if value != "true":
            print("Error Nasslaborteil_grob!")
    for value in list["nasslaborteil_fein"].values():
        if value != "true":
            print("Error Nasslaborteil_fein!")
    for value in list["blattklebetest"].values():
        if value != "true":
            print("Error BKT!")
    for value in list["visuelle beurteilung"].values():
        if value != "true":
            print("Error VB!")

    x = input("Full output? J/N: ")

    if x == "J" or x == "j":
        print(list)
    else:
        print("ok.")


if __name__ == "__main__":
    print(read("C:/Users/T.Priebe/Documents/3/ExcelCepi/examples/CEPI-method_Laufzettel_Part I_V23.07.xlsx"))