Need Help Exporting Data To Excel

This code is taking a very long time to run please review and let me know what I am doing wrong

AutoFit method is a time-consuming method. You redudently called them in your code. Please try this attached code.

thanks you

@VBDotNETCoder,
Aspose.Cells has replaced Aspose.Excel that is discarded now. This new product has all the latest features available in different versions of MS Excel. You can import data into Excel file in a variety of ways as follows:

  • Importing from Array
  • Importing from ArrayList
  • Importing from Custom Objects
  • Importing from Custom Objects to merged area
  • Importing from DataTable
  • Importing from dynamic object as data source
  • Importing from DataColumn (.NET)
  • Importing from DataView (.NET)
  • Importing from DataGrid (.NET)
  • Importing from GridView
  • Importing HTML formatted data
  • Importing Data from JSON

Here is an example that imports data into Excel file:

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET

// Instantiating a Workbook object
Workbook workbook = new Workbook();

// Obtaining the reference of the worksheet
Worksheet worksheet = workbook.Worksheets[0];

// Creating an array containing names as string values
string[] names = new string[] { "laurence chen", "roman korchagin", "kyle huang" };

// Importing the array of names to 1st row and first column vertically
worksheet.Cells.ImportArray(names, 0, 0, true);

// Saving the Excel file
workbook.Save(dataDir + "DataImport.out.xls");

For more information about importing data refer to the following document:
Import Data into Worksheet

The latest trial version can be downloaded here:
Aspose.Cells for .NET (Latest Version)

A complete runnable solution is available here for testing the product features without writing any code.