I am trying to get my output from my code to go into an excel spread sheet and I keep getting this specific error:
"Exception: Attempt to overwrite cell: sheetname=u'Sheet 1' rowx=1 colx=0"
How I have my code set up is how I need it in order to find the items and print the desired result since I am using it to scrape .PDFs and it will produce the exact output needed if I wanted to put it all into a text file. But I am hoping to output to excel so I can specify where the data should go. It seems that because the output of code cycles through the results it also tries to put everything in row 0, column 0 continuously and I keep getting an error about overriding data.
from xlwt import Workbook, Formula, easyxf
wb = Workbook()
sheet1 = wb.add_sheet('Sheet 1')
lines = open("register.txt", "r").readlines()
search_counters = {
"Per End": 0,
}
lines=[line for line in lines if line] # removes empty lines, if there are any
for i, line in enumerate(lines):
for search_key in search_counters.keys():
if search_key in line:
# print the previous line if the current line contains "Per End"
search_counters[search_key] += 1
if search_key == "Per End":
print lines[i-1]
EE_Name = lines[i-1]
wb.save('payroll2.xls')