Last active
April 8, 2022 07:38
-
-
Save groupdocs-com-kb/355d719b6aa89972d2f82969480394b8 to your computer and use it in GitHub Desktop.
How to Convert CSV to Excel in C#. For more information, please follow link: https://kb.groupdocs.com/conversion/net/how-to-convert-csv-to-excel-in-csharp/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using GroupDocs.Conversion.Options.Convert; | |
namespace ConvertCsvToExcelInCSharp | |
{ | |
class Program | |
{ | |
public static void Main(string[] args) // Main function to convert CSV to Excel using C# | |
{ | |
// Remove the watermark in output Excel document by adding license | |
string licensePath = "GroupDocs.Conversion.lic"; | |
GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License(); | |
lic.SetLicense(licensePath); | |
// Load the source CSV file for conversion to Excel | |
var converter = new GroupDocs.Conversion.Converter("sample.csv"); | |
// Set the convert options for the Excel file | |
var convertOptions = new SpreadsheetConvertOptions(); | |
// Convert and save the CSV in XLSX format | |
converter.Convert("converted.xlsx", convertOptions); | |
Console.WriteLine("Done"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment