How to Append Data in Excel Using Python Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report We are given an Excel file and our task is to append the data into this excel file using Python. In this article, we'll explore different approaches to append data to an Excel file using Python. Append Data in Excel Using PythonBelow, are some examples to understand how to append data in excel using Python: excel1.xlsx: Let's say we have an existing Excel file named 'excel1.xlsx' with the following data: excel1.xlsxExample 1: Append Data In Excel Using Pandas LibraryBefore getting started, ensure that the pandas library is installed. If not, you can install it using: pip install pandasIn this example, below Python code uses the Pandas library to append new data (e.g., {'Name': ['Bob'], 'Age': [28], 'Salary': [55000]}) to an existing Excel file ('excel1.xlsx'). It reads the existing data into a DataFrame, appends the new data, and then saves the combined data back to the original Excel file. Python3 import pandas as pd # Existing Excel file existing_file = 'excel1.xlsx' # New data to append new_data = {'Name': ['Bob'], 'Age': [28], 'Salary': [55000]} df_new = pd.DataFrame(new_data) # Read existing data df_existing = pd.read_excel(existing_file) # Append new data df_combined = df_existing.append(df_new, ignore_index=True) # Save the combined data to Excel df_combined.to_excel(existing_file, index=False) Output: updatedExample 2: Append Data In Excel Using Openpyxl LibraryIf you don't have the openpyxl library installed, you can install it using pip install openpyxlIn this example, below Python code utilizes the openpyxl library to load an existing Excel file ('existing_data.xlsx'), appends new data (e.g., ['Bob', 28, 55000]) to its active sheet, and saves the modified workbook back to the original file. Python3 from openpyxl import load_workbook # Existing Excel file existing_file = 'excel1.xlsx' # New data to append new_data = [['Bob', 28, 55000]] # Load existing workbook wb = load_workbook(existing_file) # Select the active sheet ws = wb.active # Append new data for row in new_data: ws.append(row) # Save the workbook wb.save(existing_file) Output: updatedConclusionIn conlcusion, Appending data to an existing Excel file using Python is a straightforward process with the help of libraries like pandas and openpyxl. Whether you prefer the convenience of pandas for its DataFrame operations or the direct manipulation capabilities of openpyxl, Python provides versatile tools for efficiently managing and updating Excel data. Choose the approach that best fits your workflow and data manipulation needs. Comment More infoAdvertise with us Next Article How to Append Data in Excel Using Python J jaditi930 Follow Improve Article Tags : Python Python Programs Excel-How To Python-excel Practice Tags : python Similar Reads How To Create A Csv File Using Python CSV stands for comma-separated values, it is a type of text file where information is separated by commas (or any other delimiter), they are commonly used in databases and spreadsheets to store information in an organized manner. In this article, we will see how we can create a CSV file using Python 3 min read How to Add Numbers in a Csv File Using Python When working with CSV files in Python, adding numbers in the CSV file is a common requirement. This article will guide you through the process of adding numbers within a CSV file. Whether you're new to data analysis or an experienced practitioner, understanding this skill is vital for efficient data 3 min read Copy Rows and Columns in Excel Using Python Manipulating data in Excel often involves tasks such as copying specific rows or columns based on certain conditions. Python, with its powerful libraries like Pandas and openpyxl, provides efficient solutions for handling Excel files. In this article, we will explore how to copy rows and columns in 3 min read Convert Excel To Json With Python In the realm of data manipulation and analysis, the ability to convert data between different formats is a valuable skill. Excel and JSON are two widely used formats, and Python, with its powerful libraries, provides a seamless way to convert Excel files into JSON. In this article, we will see how w 4 min read Append Multiple items to List - Python Appending items to a list in Python is an essential and common operation when working with different data structures. Sometimes, we need to add more than one item to a list at a time and in this article, we will explore the various ways to append multiple items to a list at the same time.Using exten 2 min read How to Append Objects in a List in Python The simplest way to append an object in a list using append() method. This method adds an object to the end of the list. Pythona = [1, 2, 3] #Using append method to add object at the end a.append(4) print(a) Output[1, 2, 3, 4] Let's look into various other methods to append object in any list are:Ta 2 min read Append Text or Lines to a File in Python Appending text or lines to a file is a common operation in programming, especially when you want to add new information to an existing file without overwriting its content. In Python, this task is made simple with built-in functions that allow you to open a file and append data to it. In this tutori 3 min read Exporting Multiple Sheets As Csv Using Python In data processing and analysis, spreadsheets are a common format for storing and manipulating data. However, when working with large datasets or conducting complex analyses, it's often necessary to export data from multiple sheets into a more versatile format. CSV (Comma-Separated Values) files are 3 min read Fastest Way to Read Excel File in Python Reading Excel files is a common task in data analysis and processing. Python provides several libraries to handle Excel files, each with its advantages in terms of speed and ease of use. This article explores the fastest methods to read Excel files in Python.Using pandaspandas is a powerful and flex 3 min read Add items to List While Iterating - Python Python has many ways to append to a list while iterating. List comprehension is a compact and efficient way to append elements while iterating. We can use it to build a new list from an existing one or generate new values based on a condition.Pythona = [1, 2, 3] a += [i + 4 for i in range(3)] print( 2 min read Like