Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-com-kb/a3264421a37e53488e9e8232fc16e70d to your computer and use it in GitHub Desktop.
Save aspose-com-kb/a3264421a37e53488e9e8232fc16e70d to your computer and use it in GitHub Desktop.
Export Large Excel File to CSV in C#. In order to better understand how you can export large Excel file in C# see our Knowledge Base topic:https://kb.aspose.com/cells/net/how-to-export-large-excel-file-to-csv-in-c-sharp/
using System;
//Add reference to Aspose.Cells for .NET API
//Use following namespaces to Export excel file to CSV
using Aspose.Cells;
namespace ExportLargeExcelFiletoCSV
{
class Program
{
static void Main(string[] args)
{
//Set Aspose license before exporting Excel file to CSV file format
//using Aspose.Cells for .NET
Aspose.Cells.License AsposeCellsLicense = new Aspose.Cells.License();
AsposeCellsLicense.SetLicense(@"c:\asposelicense\license.lic");
//For optimized memory usage for large excel file use
//MemoryPreference MemorySetting option
LoadOptions OptionsLoadingLargeExcelFile = new LoadOptions();
OptionsLoadingLargeExcelFile.MemorySetting = MemorySetting.MemoryPreference;
//Create an instance of Workbook class to load input large excel file
//Also pass the MemoryPreference load options to the constructor
Workbook ExportExcelToCSVWorkBook = new Workbook("Large_Excel_To_Export.xlsx", OptionsLoadingLargeExcelFile);
//Save the exported output file as CSV format
ExportExcelToCSVWorkBook.Save("Exported_Output_CSV.csv", SaveFormat.Csv);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment