January 2019
Beginner
318 pages
8h 23m
English
In this section, we are going to append values in Excel. For that, we are going to use the append() method. We can add a group of values at the bottom of the current sheet in which we want to put the values. Create a script called append_values.py and write the following content in it:
from openpyxl import Workbook book_obj = Workbook()excel_sheet = book_obj.activerows = ( (11, 12, 13), (21, 22, 23), (31, 32, 33), (41, 42, 43))for values in rows: excel_sheet.append(values) print()print("values are successfully appended")book_obj.save('test.xlsx')wb.save('append_values.xlsx')
Run the script and you will get the following output:
student@ubuntu:~/work$ python3 append_values.py
Following is the output:
values are successfully ...
Read now
Unlock full access