We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Excel email

Is it possible to create an excel file in memory and send it as an attachment to an email using Aspose.Excel?

If so, could you show an example or point me in the right direction?

Thanks very much,
Charles Watson

Hi Charles,

You can refer to Excel.Save(string,FileFormatType,out MemoryStream);
method to create an excel file in memory. And you can refer to System.Web.Mail namespace in MSDN to send an email.

I am not familiar with mail programming so I cannot post a sample right now.

@cws111,
Aspose.Cells has replaced Aspose.Excel which is no more continued now. This new product not only saves data to memory stream but it also provides many other options to save the Excel file. Here is an example which demonstrates saving the Excel file to stream:

// Load your source workbook
Workbook workbook = new Workbook(filePath);
FileStream stream = new FileStream(dataDir + "output.xlsx", FileMode.CreateNew);
workbook.Save(stream, new XlsSaveOptions(SaveFormat.Xlsx));
stream.Close();

Here is a link to the details on this topic:
Different Ways to Save Files

Here is the link to the latest version of this new product:
Aspose.Cells for .NET (Latest Version)

We have prepared a runnable solution to test the features of this new product. You can download this solution here.