Python Forum
Updating the Pandas dataframe to existing excel workbook in existing worksheet.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Updating the Pandas dataframe to existing excel workbook in existing worksheet.
#1
Hi All,

i am new to python programming, i was trying to read as huge CSV file with pandas dataframe using df=pd.read_csv.
after reading the data into the data frame i need to update the same data to the existing excel workbook in existing worksheet.
but my problem is i am seeing that the excel is not updating at all.

anyone can help me with this please if they have solution.
below is mycode
import pandas as pd
filename='D:/Users/Python Codes/SchoolSample.xlsx'
writer=pd.ExcelWriter(filename,engine='openpyxl')
df=pd.read_csv('D:/Users/Python Codes/C2ImportSchoolSample.csv',sep=',',engine='python')
df.to_excel(writer,sheet_name='Sheet1',index=False,header=None)
writer.save()
Reply
#2
Which version of Python and which version of pandas ? Have you tried without the engine argument?
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question [Solved] Formatting cells of a pandas dataframe into an OpenDocument ods spreadsheet Calab 1 424 Mar-01-2025, 04:51 AM
Last Post: Calab
  Find duplicates in a pandas dataframe list column on other rows Calab 2 1,822 Sep-18-2024, 07:38 PM
Last Post: Calab
  Find strings by index from a list of indexes in a different Pandas dataframe column Calab 3 1,513 Aug-26-2024, 04:52 PM
Last Post: Calab
  Add NER output to pandas dataframe dg3000 0 1,096 Apr-22-2024, 08:14 PM
Last Post: dg3000
  Pandas keep existing format of Excel AlphaInc 2 10,130 Jan-11-2024, 03:44 AM
Last Post: plonkarchivist
  How to count total number of sheets in an excel workbook using polars sayyedkamran 0 1,314 Oct-27-2023, 09:54 PM
Last Post: sayyedkamran
  HTML Decoder pandas dataframe column mbrown009 3 2,528 Sep-29-2023, 05:56 PM
Last Post: deanhystad
  Use pandas to obtain cartesian product between a dataframe of int and equations? haihal 0 1,950 Jan-06-2023, 10:53 PM
Last Post: haihal
  validate the existing value and change the series datahub 0 1,565 May-03-2022, 08:00 PM
Last Post: datahub
  Pandas Dataframe Filtering based on rows mvdlm 0 2,019 Apr-02-2022, 06:39 PM
Last Post: mvdlm

Forum Jump:

User Panel Messages

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