Kashirigi
6 years ago
1 changed files with 20 additions and 0 deletions
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
import openpyxl as op |
||||
#Looks up spreadsheet values then splits them. Convenenient when |
||||
#getting forms that are badly formatted. |
||||
|
||||
book = op.load_workbook('a.xlsx') |
||||
sheet = book.active |
||||
sheet['F1'].value = 'Last Name' |
||||
sheet['G1'].value = 'First Name' |
||||
for count, cell in enumerate(sheet['A']): |
||||
if count == 0 : |
||||
continue |
||||
else: |
||||
print(count, cell.value) |
||||
if cell.value: |
||||
split = cell.value.find(' ') |
||||
firstname = cell.value[:split] |
||||
lastname = cell.value[split+1:] |
||||
sheet['F'+str(count+1)] = lastname |
||||
sheet['G'+str(count+1)] = firstname |
||||
book.save('a.xlsx') |
Loading…
Reference in new issue