Test in production without watermarks.
Works wherever you need it to.
Get 30 days of fully functional product.
Have it up and running in minutes.
Full access to our support engineering team during your product trial
Create and output a CSV file easily with IronXL's free for development. The following code shows you how.
First, you must have IronXL installed. There are various options. You can download it directly: https://ironsoftware.com/csharp/excel/docs/
Or you can import the IronXL NuGet package by following the next few steps
# Install IronXL via the NuGet Package Manager Console
Install-Package IronXL.Excel
# Install IronXL via the NuGet Package Manager Console
Install-Package IronXL.Excel
IronXL.Excel NuGet Package
Easy as that!
Here is the code for this little project. This code loads an existing Excel Workbook, and then simply saves it in the CSV format by using the SaveAsCsv
method.
The Normal Excel workbook contains the following data:
// Import the IronXL library
using IronXL;
class Program
{
static void Main()
{
// Load an existing workbook
WorkBook wb = WorkBook.Load("Normal_Excel_File.xlsx"); // You can import .xls, .csv, or .tsv files
// Save the workbook to a CSV file. This will save the first worksheet as a CSV.
wb.SaveAsCsv("SaveAsCSV.csv", ","); // This will output: SaveAsCSV.Sheet1.csv
}
}
// Import the IronXL library
using IronXL;
class Program
{
static void Main()
{
// Load an existing workbook
WorkBook wb = WorkBook.Load("Normal_Excel_File.xlsx"); // You can import .xls, .csv, or .tsv files
// Save the workbook to a CSV file. This will save the first worksheet as a CSV.
wb.SaveAsCsv("SaveAsCSV.csv", ","); // This will output: SaveAsCSV.Sheet1.csv
}
}
' Import the IronXL library
Imports IronXL
Friend Class Program
Shared Sub Main()
' Load an existing workbook
Dim wb As WorkBook = WorkBook.Load("Normal_Excel_File.xlsx") ' You can import .xls, .csv, or .tsv files
' Save the workbook to a CSV file. This will save the first worksheet as a CSV.
wb.SaveAsCsv("SaveAsCSV.csv", ",") ' This will output: SaveAsCSV.Sheet1.csv
End Sub
End Class
Additionally, the IronXL Excel library provides the following features:
Learn more and share how to merge, unmerge, and work with cells in Excel spreadsheets using the handy IronXL API Reference Documentation.
IronXL API Reference DocumentationIronXL is a software library for C# that allows developers to manipulate Excel files, including creating and outputting CSV files, among other features.
You can install IronXL via the NuGet Package Manager by right-clicking on the Solution in the Solution Explorer, selecting 'Manage NuGet Packages', browsing for IronXL.Excel, and clicking 'Install'. Alternatively, use the command `Install-Package IronXL.Excel` in the NuGet Package Manager Console.
To create a CSV file, load an existing Excel workbook using IronXL and then use the `SaveAsCsv` method to save it in the CSV format.
IronXL supports Excel's most popular file formats, including .xlsx, as well as other formats like .xls, .csv, and .tsv.
Yes, IronXL offers a broad set of functions for data manipulation, including data import, data export, and importing from other sources.
Yes, IronXL fully supports chart management that is compatible with Excel.
IronXL supports various cell formatting options such as text alignment, font size, color, and gridlines.
The IronXL API reference documentation can be accessed on the IronXL website under the API Reference Documentation section.