Creating Excel Sheets with Python!

If you would like to create an Excel Sheet with Python, then you can do something like this:

circle-exclamation
import pandas as pd

#Enter your data, example format:
data = {
    'Name': ['Alice', 'Bob', 'John'],
    'Age': [25,30,45]
}

#Converts our data to a DataFrame
df = pd.DataFrame(data)

#Export to excel -> Will create the file in your Home directory
#You can change your Path to whatever you wish
df.to_excel("/home/gr1ff1n/Desktop/excel-sheet1.xlsx", index=False)

#Debugging & Success message
print("Excel file created!")

And as we can see, a beautiful excel sheet πŸ˜„

Last updated