def importFromXLS6(): import xlrd customList = xlrd.open_workbook("ALL STOCKIEST.xlsx") worksheet = customList.sheet_by_name("MARG ERP 9+ Excel Report") for i in range(5, 58): customer = worksheet.cell(i, 1).value city = worksheet.cell(i, 2).value customerObject = Customer() customerObject.cName = customer customerObject.city = city customerObject.save()
def importFromXLS4(): import xlrd customList = xlrd.open_workbook("ALL PARTY DETAILS.xlsx") worksheet = customList.sheet_by_name("Sheet1") for i in range(2, 50): customer = worksheet.cell(i, 0).value city = worksheet.cell(i, 3).value address = worksheet.cell(i, 10).value customerObject = Customer() customerObject.cName = customer customerObject.address = address customerObject.city = city customerObject.save()
def save(self, user): try: data = user.get_profile() except: data = Customer(user=user) print 'Inside save method of UserRegForm' data.first_name = self.cleaned_data["first_name"] data.last_name = self.cleaned_data["last_name"] data.address = self.cleaned_data["address"] data.city = self.cleaned_data["city"] data.zip = self.cleaned_data["zip"] data.date_of_birth = self.cleaned_data["date_of_birth"] data.save()
def importFromXLS(): import xlrd customList = xlrd.open_workbook("list.xls") worksheet = customList.sheet_by_name("Sheet1") for i in range(9, 3582): if worksheet.cell(i, 9).value != "": city = worksheet.cell(i, 9).value if worksheet.cell(i, 7).value != "": uniqueCode = worksheet.cell(i, 3).value customer = worksheet.cell(i, 7).value address = worksheet.cell(i, 14).value customerObject = Customer() customerObject.cName = customer customerObject.address = address customerObject.city = city customerObject.usn = uniqueCode customerObject.save()
def importFromXLS1(): import xlrd customList = xlrd.open_workbook("VVM STOCKIEST LIST.XLS") worksheet = customList.sheet_by_name("Sheet1") for i in range(5, 707, 6): code = worksheet.cell(i, 1).value customer = worksheet.cell(i, 3).value address1 = worksheet.cell(i + 1, 3).value address2 = worksheet.cell(i + 2, 3).value address3 = worksheet.cell(i + 3, 3).value city = worksheet.cell(i + 4, 3).value customerObject = Customer() customerObject.cName = customer customerObject.address = address1 + " " + address2 + " " + address3 customerObject.city = city customerObject.usn = code customerObject.save()