Python Forum
Append excel sheet using openpyxl
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Append excel sheet using openpyxl
#1
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()
Reply
#2
What does that code do?
Are there any errors? What are they?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python script for excel sheet Nabil 5 303 Jun-01-2021, 02:29 PM
Last Post: anuradha
  Add a new column when I extract each sheet in an Excel workbook as a new csv file shantanu97 0 368 Mar-24-2021, 04:56 AM
Last Post: shantanu97
  How to append a value to specific excel cell using openpyxl hobbyist 0 591 Mar-05-2021, 07:14 PM
Last Post: hobbyist
  How to Copy Single Value From One Excel Sheet to Another SunWers 4 567 Dec-29-2020, 05:39 PM
Last Post: SunWers
  Openpyxl tkinter search a value in Excel column Heathcliff_1 0 595 Dec-02-2020, 04:35 PM
Last Post: Heathcliff_1
  Writing to existing excel sheet jksvend 0 430 Oct-12-2020, 11:19 AM
Last Post: jksvend
  Openpyxl: Excel formula & condition formatting removed JaneTan 0 606 Sep-25-2020, 07:02 AM
Last Post: JaneTan
  Create new Excel instead of update certain sheet Pietertl 1 591 Sep-17-2020, 07:04 AM
Last Post: Pietertl
  Edit Open and Active Excel sheet in Python JoeDainton123 1 590 Jul-29-2020, 12:52 AM
Last Post: Larz60+
  copy content of text file with three delimiter into excel sheet vinaykumar 0 502 Jul-12-2020, 01:27 PM
Last Post: vinaykumar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020