Python Forum
Append excel sheet using openpyxl - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Append excel sheet using openpyxl (/thread-32281.html)



Append excel sheet using openpyxl - TammyP - Feb-01-2021

The code below does not append
Can anyone help please

from openpyxl import load_workbook
workbook_name = '/home/pi/Desktop/Data/Test.xlsx'
wb = load_workbook(workbook_name)
page = wb.active
import openpyxl as op
Col1 = 'Apples'
Col2 = 'Pears'
wb = op.load_workbook(workbook_name)
ws = wb[wb.sheetnames[0]]
ws.append([Col1, Col2])
wb.save(workbook_name)
wb.close()



RE: Append excel sheet using openpyxl - nilamo - Feb-02-2021

What does that code do?
Are there any errors? What are they?