From 788521ae9916bbf00f7b7fce8ee2692915fa8a8b Mon Sep 17 00:00:00 2001 From: Dan Dembinski Date: Fri, 19 Feb 2021 13:43:47 -0500 Subject: [PATCH] Clean up. Updated requirements.txt --- main.py | 36 ++++++++++++++++++------------------ requirements.txt | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/main.py b/main.py index dabc13e..3f0ab38 100644 --- a/main.py +++ b/main.py @@ -63,9 +63,10 @@ session = Session() for user in session.query(User).filter(User.ID == 14): ActiveUser.append([user.ID, user.FirstName, user.LastName]) -# loop through each user in the ActiveUser array +# loop through each user in the ActiveUser array. Combine Users First/Last name for the filename and +# the first letter/last name combo for username for each in ActiveUser: -# Combine Users First/Last name into single variable + # FileName = each[1] + ' ' + each[2] UserName = each[1][0]+each[2] @@ -74,21 +75,21 @@ for each in ActiveUser: ws = wb.add_sheet('Addresses') # Write header row - ws.write(0,0,'ACTION') - ws.write(0,1,'BU_ID') - ws.write(0,2,'LOGIN_ID') - ws.write(0,3,'PA_NAME') - ws.write(0,4, 'PA_NAME2') - ws.write(0,5,'LINE1') - ws.write(0,6,'LINE2') - ws.write(0,7,'LINE3') - ws.write(0,8,'CITY') - ws.write(0,9,'STATE') - ws.write(0,10,'ZIP') - ws.write(0,11,'COUNTRY') - ws.write(0,12,'PHONE_NR') - ws.write(0,13,'SHIP_TO_ATTN_TX') - ws.write(0,14, 'PROFILE_TYPE') + ws.write(0, 0, 'ACTION') + ws.write(0, 1, 'BU_ID') + ws.write(0, 2, 'LOGIN_ID') + ws.write(0, 3, 'PA_NAME') + ws.write(0, 4, 'PA_NAME2') + ws.write(0, 5, 'LINE1') + ws.write(0, 6, 'LINE2') + ws.write(0, 7, 'LINE3') + ws.write(0, 8, 'CITY') + ws.write(0, 9, 'STATE') + ws.write(0, 10, 'ZIP') + ws.write(0, 11, 'COUNTRY') + ws.write(0, 12, 'PHONE_NR') + ws.write(0, 13, 'SHIP_TO_ATTN_TX') + ws.write(0, 14, 'PROFILE_TYPE') # For each username we're filtering the UserAddress table by their userID and adding it to the UserAddressID array. @@ -102,7 +103,6 @@ for each in ActiveUser: # Combine all the required fields into one variable for simplicity AddresssBookLine = UserName, cn[0].CompanyName, cn[0].Line1, cn[0].Line2, cn[0].City, cn[1].StateName, cn[0].PostalCode, cn[2].CountryName, cn[0].PhoneNumber,cn[0].ContactName # Loop through each row and populate the variable columns with the corresponding AddressBookLine element - print(LineCount) ws.write(LineCount, 2, AddresssBookLine[0]) ws.write(LineCount, 3, AddresssBookLine[1]) ws.write(LineCount, 5, AddresssBookLine[2]) diff --git a/requirements.txt b/requirements.txt index c022597..0268cf0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ pymssql==2.1.5 SQLAlchemy==1.3.23 +xlwt==1.3.0