How to Convert a CSV File to Microsoft Excel in R Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report CSV refers to Comma-Separated Values. It holds plain text as a series of values (cells) separated by commas (, ) in a series of lines (rows). CSV file can actually open in a text editor and read it. On the other hand, Excel is used to display the data in horizontal and vertical rows. The data are usually stored in the cells. We have an option of formulas in Excel that can be used for data and its place of storage. So, In this article, we are going to convert the CSV(Comma Separated Values) file into an Excel file using R Programming. So to do this first we need to read the contents of the CSV file into our R console and later on write it an excel file using functions in R. The xlsx package in R is used to manipulate data of an excel file using R. Syntax: write.xlsx(df,file,sheetName,col.names,row.names,append,showNA,password) where, df - data frame to be converted.file - the path to output file(excelfile) is specified here.sheetName - to string is passed as sheet name.col.names - logical value indicating if the column names of the data frame are to be written in the file.row.names - logical value indicating if the column names of the data frame are to be written in the file. The code to Convert a CSV File to Microsoft Excel is given below. R # install required packages install.packages("xlsx") # load the package library(xlsx) # Read the contents of CSV file as dataframe df<- read.csv("C:\\Users\\Downloads\\biostats.csv") # convert the data frame to excel file xlsx::write.xlsx(df, "Hello.xls", col.names=TRUE, row.names=TRUE, sheetName="sample") Output: ExplanationAs discussed earlier to manipulate the excel data we need installed the package xlsx.First we need to read the contents of CSV file in R using read.csv() function in R.Later on using write.xlsx(0 function we converted the csv file data which is stored as data frame into an excel file at our specified path.NoteDuring package installation it asks to select the CRAN mirror then on that window select your country.If we have not specified path in write.xlsx() function then by default the excel file is going to save where the R documents(Script files) are stored y default. Comment More infoAdvertise with us Next Article How to import an Excel File into R ? S sri06harsha Follow Improve Article Tags : Technical Scripter R Language Technical Scripter 2022 Similar Reads How to import an Excel File into R ? In this article, we will discuss how to import an excel file in the R Programming Language. There two different types of approaches to import the excel file into the R programming language and those are discussed properly below. File in use: Method 1: Using read_excel() In this approach to import th 3 min read How to convert CSV into array in R? In this article, we are going to see how to convert CSV into an array in R Programming Language. If we load this file into any environment like python, R language .etc, the data will be displayed in rows and columns format, let us convert CSV file into an array. Each and every column in the CSV will 2 min read How to Convert XML to CSV in R? Converting data from XML to CSV format can be a handy skill, especially when you need to work with data in a more accessible format like CSV. Here, we'll discuss about the process of converting XML files to CSV using R programming language for data analysis.What is XML (eXtensible Markup Language)?X 4 min read Methods to Convert xlsx Format Files to CSV on Linux CLI XLSX is a format/file extension for Open XML Spreadsheet file format used by Microsoft Excel. Transforming xlsx to csv (comma-separated file) is easy via command line. Here are few methods to convert xlsx to csv format. Gnumeric Spreadsheet ProgramIt is a GNOME-based program, a spreadsheet applicati 4 min read How to read excel file in R ? We may work with structured data from spreadsheets, take advantage of R's capabilities for data analysis and manipulation, and incorporate Excel data into other R processes and packages by reading Excel files in R. The readxl package offers a simple and effective method for reading Excel files into 3 min read How to convert excel content into DataFrame in R ? R Programming Language allows us to read and write data into various files like CSV, Excel, XML, etc. In this article, we are going to discuss how to convert excel content into DataFrame in R Programming. To read an excel file itself, read.xlsx() function from xlsx is used. Installation This module 2 min read Like