Copying a row from a range of Excel files to another
Cecil Westerhof
Cecil at decebal.nl
Wed Jun 26 17:14:19 EDT 2019
MRAB <python at mrabarnett.plus.com> writes:
> Does Workbook support the 'with' statement?
>
> If it does, then that's the best way of doing it.
>
> (Untested)
>
> with Workbook() as wb_out:
> for filepath in filepathArr:
> current_row = []
>
> with load_workbook(filepath) as wb_in:
> for cell in wb_in.active[src_row]:
> current_row.append(cell.value)
>
> wb_out.active.append(current_row)
>
> wb_out.save(report_start + datetime.now().strftime('%Y-%m-%d') +
> report_end)
It seems not. I get AttributeError.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
More information about the Python-list
mailing list