Python Script to Convert CSV File to Excel File Using Pandas & openpyxl Library Full Tutorial For Beginners

Python Script to Convert CSV File to Excel File Using Pandas & openpyxl Library Full Tutorial For Beginners

 

Welcome folks in this blog post we will be converting csv file to excel file with the help of pandas library . All the source code of the tutorial will be given below.

 

 

Get Started

 

 

In order to get started you need to install pandas library with the help of pip command

 

pip install pandas

 

Now install openpyxl library with the help of pip command

 

pip install openpyxl

 

 

Now create a app.py file and copy paste the following code here

 

 

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) 
  
GFG.save()

 

See also  Python 3 Tkinter Dropdown Formatted Calendar Widget with Date and Time GUI Script Desktop App Full Project For Beginners

 

Leave a Reply