2

Following is my code snippet:

writer = pd.ExcelWriter(path_file, engine= 'openpyxl')
df.to_excel(writer, index= False)

df.to_excel(writer, startrow= len(df), index= False)

writer.save()

df has all the data I need to append.

I have a master excel sheet that is linked to a Tableau workbook.

I have pulled a large amount of data into data frames, and I want to be able to append the data frames to the existing master excel sheet.

I've looked at other solution on stackoverflow, but have been unable to find any solutions that work.

The problem right now it is just completely overwriting the file and creating a new copy.

Any ideas? Thanks :D

PseudoAj
  • 5,234
  • 2
  • 17
  • 37
arthur6523
  • 115
  • 1
  • 3
  • 7

2 Answers2

2

Use csvtools. Free command line utilities for working with CSV files.

https://csvkit.readthedocs.io

You could use in2csv to convert Excel to CSV, and csvstack to combine multiple CSV files. csvkit is written in Python and plays well with Python, but can be used as a standalone suite of tools. Follows the same design approach as the simple Unix command line tools.

Alex Blakemore
  • 11,301
  • 2
  • 26
  • 49
1

Could you convert the excel file to a csv? Python handles them great. And just use the "a" - append option which will do the job fine. Excel can also handle csv files easily.