Jan-15-2019, 02:56 AM
Kept trying, but thus far to no avail. I think the real problem is that I'm not conceptualizing what's happening at each stage and being able to then convert that to proper code.
What I wrote below got rid of the error, but didn't write any data into the various workbooks/spreadsheets either (other than the sheet names). The print(header) does print the five field names a BUNCH of times, which I also didn't expect.
What I wrote below got rid of the error, but didn't write any data into the various workbooks/spreadsheets either (other than the sheet names). The print(header) does print the five field names a BUNCH of times, which I also didn't expect.
for group, rows in sorted(groups.items()): wb = Workbook() wb.remove(wb.active) dest_filename = (mainfile[:-5] + " Group " + group + ".xlsx") for row in sorted(rows, key=lambda x: x[-1][:-1]): subgroup = row[-1][:-1] wb.create_sheet(title = subgroup) for item in header: print(item) r=0 ch=0 #column for the header record ws.cell(row=(r+1), column=(ch+1)).value = item