Skip to content
Related Articles

Related Articles

Improve Article
Convert CSV to Excel using Pandas in Python
  • Last Updated : 02 Jul, 2020

Pandas can read, filter, and re-arrange small and large datasets and output them in a range of formats including Excel. In this article, we will be dealing with the conversion of .csv file into excel (.xlsx).

Pandas provide the ExcelWriter class for writing data frame objects to excel sheets.

final = pd.ExcelWriter('GFG.xlsx')


Sample CSV File:


import pandas as pd
import numpy as np
# Reading the csv file
df_new = pd.read_csv('Names.csv')
# saving xlsx file
GFG = pd.ExcelWriter('Names.xlsx')
df_new.to_excel(GFG, index = False)



 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :