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
  Pandas keep existing format of Excel AlphaInc 2 1,009 Jan-11-2024, 03:44 AM
Last Post: plonkarchivist
  How to count total number of sheets in an excel workbook using polars sayyedkamran 0 663 Oct-27-2023, 09:54 PM
Last Post: sayyedkamran
  HTML Decoder pandas dataframe column mbrown009 3 1,027 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,118 Jan-06-2023, 10:53 PM
Last Post: haihal
  validate the existing value and change the series datahub 0 1,209 May-03-2022, 08:00 PM
Last Post: datahub
  Pandas Dataframe Filtering based on rows mvdlm 0 1,430 Apr-02-2022, 06:39 PM
Last Post: mvdlm
  Pandas dataframe: calculate metrics by year mcva 1 2,311 Mar-02-2022, 08:22 AM
Last Post: mcva
  Pandas dataframe comparing anto5 0 1,260 Jan-30-2022, 10:21 AM
Last Post: anto5
  PANDAS: DataFrame | Replace and others questions moduki1 2 1,795 Jan-10-2022, 07:19 PM
Last Post: moduki1
  PANDAS: DataFrame | Saving the wrong value moduki1 0 1,551 Jan-10-2022, 04:42 PM
Last Post: moduki1

Forum Jump:

User Panel Messages

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