def __getExcelLists(self, sheetnames, xlWb , dlg): 
        lists = []
        if len(sheetnames)!=11:
            return Utils.parseError("wrong number of Sheets"), []
        try:
            sht = xlWb.Worksheets(sheetnames[0])
            Q1=Utils.tupleToList(sht.Range("Q1_GeneralData"))    
            Q1+=Utils.tupleToList(sht.Range("Q1_StatisticalData"))
            Q1+=Utils.tupleToList(sht.Range("Q1_Operation"))
            QProduct =Utils.tupleToList(sht.Range("Q1_Products"))
        except:
            return Utils.parseError(sheetnames[0]), []
        dlg.update(13)
        try:
            sht = xlWb.Worksheets(sheetnames[1])
            Q1+=Utils.tupleToList(sht.Range("Q1_Percent"))
            QProduct+=Utils.tupleToList(sht.Range("Q2_Products"))
            
            Q2 = Utils.tupleToList(sht.Range("Q2_EnergyConsumption"))
            Q2 += Utils.tupleToList(sht.Range("Q2_ElectricityConsumption"))
            Q2 += Utils.tupleToList(sht.Range("Q2_EnergyConsumptionProduct"))
            QFuel = Utils.tupleToList(sht.Range("Q2_EnergyConsumption"))
        except:
            return Utils.parseError(sheetnames[1]), []
        dlg.update(22)
        try:
            sht = xlWb.Worksheets(sheetnames[2])
            Q3 = Utils.tupleToList(sht.Range("Q3_ProcessData"))
            Q3 += Utils.tupleToList(sht.Range("Q3_WasteHeat"))
            Q3 += Utils.tupleToList(sht.Range("Q3_Schedule")) 
            Q3 += Utils.tupleToList(sht.Range("Q3_DataOfExistingHCSupply")) 
        except:
            return Utils.parseError(sheetnames[2]), []
        dlg.update(31)
        try:    
            sht= xlWb.Worksheets(sheetnames[3])
            Q3+= Utils.tupleToList(sht.Range("Q3_ScheduleTolerance"))
            Q3+= Utils.tupleToList(sht.Range("Q3_OperationCycle"))
            Q3+= Utils.tupleToList(sht.Range("Q3_ScheduleCorrelation"))
        except:
            return Utils.parseError(sheetnames[3]), []
        dlg.update(40)    
        try:    
            sht = xlWb.Worksheets(sheetnames[8])
            QRenewables = Utils.tupleToList(sht.Range("Q7_Interest"))
            QRenewables += Utils.tupleToList(sht.Range("Q7_REReason"))
            QRenewables += Utils.tupleToList(sht.Range("Q7_Others"))
            QRenewables += Utils.tupleToList(sht.Range("Q7_Latitude"))
            QRenewables += Utils.tupleToList(sht.Range("Q7_Biomass"))
            
            QSurf = Utils.tupleToList(sht.Range("Q7_Area"))
            QSurf += Utils.tupleToList(sht.Range("Q7_Roof"))
        except:
            return Utils.parseError(sheetnames[8]), []
        dlg.update(49)  
        try:    
            sht = xlWb.Worksheets(sheetnames[3])
            QProfiles = []
            QProcNames = Utils.tupleToList(sht.Range("Q3A_ProcessName"))
            for i in xrange(3):
                QProfil = Utils.tupleToList(sht.Range("Q3A_Profiles_"+ str(i+1)))
                QProfil.append(QProcNames[i*3])
                QProfiles.append(QProfil)
        
            QIntervals  = Utils.tupleToList(sht.Range("Q3A_StartTime_1"))
            QIntervals += Utils.tupleToList(sht.Range("Q3A_StartTime_2"))
            QIntervals += Utils.tupleToList(sht.Range("Q3A_StartTime_3"))
            QIntervals += Utils.tupleToList(sht.Range("Q3A_EndTime_1"))
            QIntervals += Utils.tupleToList(sht.Range("Q3A_EndTime_2"))
            QIntervals += Utils.tupleToList(sht.Range("Q3A_EndTime_3"))
        except:
            return Utils.parseError(sheetnames[3]), []
        dlg.update(57)
        try:
            sht = xlWb.Worksheets(sheetnames[10])
            Q9Questionnaire=[]
            for i in xrange(3):
                Q9Questionnaire+=Utils.tupleToList(sht.Range("Q9_"+str(i+1)))
        except:
            return Utils.parseError(sheetnames[10]), []
            
        dlg.update(66)
        Q4_8 = []    
        for i in xrange(5):
            try:
                Q4_8.append(Utils.tupleToList(xlWb.Worksheets(sheetnames[4]).Range("Q4H_"+str(i+1))))
                
            except:
                return self.parseError(sheetnames[4])
                
            try:    
                Q4_8.append(Utils.tupleToList(xlWb.Worksheets(sheetnames[5]).Range("Q4C_"+str(i+1))))
            except:
                return self.parseError(sheetnames[5])
            
            try:
                Q4_8.append(Utils.tupleToList(xlWb.Worksheets(sheetnames[6]).Range("Q5_"+str(i+1))))
            except:
                return self.parseError(sheetnames[6])
            
            try:
                Q4_8.append(Utils.tupleToList(xlWb.Worksheets(sheetnames[7]).Range("Q6_"+str(i+1))))
                
            except:
                return self.parseError(sheetnames[7])
                
            try:
                Q4_8.append(Utils.tupleToList(xlWb.Worksheets(sheetnames[9]).Range("Q8_"+str(i+1))))
                
            except:
                return self.parseError(sheetnames[9])
        try:
            latitude = self.__xlWb.Worksheets(sheetnames[8]).Range("Q7_Latitude")
        except:
            return self.parseError(sheetnames[8])
        dlg.update(72)

        lists.append(Q1)
        lists.append(Q2)
        lists.append(QProduct)
        lists.append(QFuel)
        lists.append(Q3)
        lists.append(QRenewables)
        lists.append(QSurf)
        lists.append(QProfiles)
        lists.append(QIntervals)
        lists.append(Q9Questionnaire)
        lists.append(Q4_8)
        lists.append(latitude)
        
        
        """
        biglist = []
        for listelem in lists:
            QList = []
            for elem in listelem:
                try:
                    QList.append(float(elem))
                except:
                    try:
                        QList.append(float(str(elem).replace(',', '.')))
                    except:
                        if type(elem) == type(QList):
                           list = []
                           for el in elem:
                               try:
                                   list.append(float(el))
                               except:
                                   try:
                                       list.append(float(str(el).replace(',', '.')))
                                   except:
                                       list.append(el)
                           QList.append(list)
                        else:
                            QList.append(elem)
            biglist.append(QList)
        print biglist
        """
       
        return "", lists
Example #2
0
 def parseRange(self, range, sht):
     return Utils.tupleToList(self.__xlWb.Worksheets(sht).Range(range))