Free Support Forum -

Error opening Large Excel After Opening and Not Saving

We have come across a problem with one of our larger files. This Excel file contains just over 39,000 rows and is 18 columns wide. File size is roughly 10MB.
Here are some additional notes regarding how we are using the product:
- Aspose is using the PutValue() method to populate the file.
- We are running AutoFitColumn() on each column before calling Save()
- We are using Microsoft Office Excel 2003 to open these files.

Here is how we reproduce the error:

1) Our application uses Aspose.Excel to generate the Excel file and save it to disk.
2) We open the new file in Excel, preview the data, and then close it without making any changes.
3) We are prompted to "Save Changes....[since] Excel recalculates formulas when opening files last saved by an earlier version of Excel...", but we say NO.
4) We try to open the file again, but we get the following error:
'[Filename]' cannot be accessed. The file may be read-only, or you may be trying to access a read-only location.
At this point, the file appears corrupt and will not open.

Now, if we choose to Save the file after opening it for the first time, then everything works fine and we are able to open it again & again without issue.

It seems this only happens with large files. The smaller files (several thousand rows) can be opened, closed without saving even though it still prompts you to Save with the same message I posted above, and then opened again without issue.

Our question, do we need to manually open and re-save these larger files so we don't run into the problem of a customer opening the file for the first time, closing without saving, and then being unable to open it again? If so, at what point [filesize/rowcount] do we need to consider doing this?


  1. Which version of Aspose.Excel are you using? Have you tried the latest fix?
    2. Is it possible to zip and post your corrupt file here? It can be only viewed by you and Aspose developers.

And does your file contain pivot table/chart? Do you use OpenInExcel option to send file to client browser? What if you directly save the file on disk with Aspose.Excel?

Aspose.Excel version is: I can't send the file (contains SSN's). And, I can't remove that data without opening it up, removing it, and saving it which would cause the problem to go away.

No pivot tables or charts. Just raw data. We don’t use OpenInExcel. No files are sent to the browser. The app saves the file to disk, and then we are opening it up by browsing to it in Windows Explorer.

Do you use a template file? Could you please post your sample code here?

We do use a template file. It is attached.

Here is the code. NOTE: the object being looped through in the foreach statement (detailData) is a custom Strongly Typed DataSet.

/// Creates an eBill (Excel document) and saves it to disk.

/// The eBills period
/// The billId of the eBill that will be created
public static void CreateEbill(int period, int billId) {
   // Get Bill
Bill b = BillDAO.GetBill(billId);
   // Get eBill
Ebill ebill = EbillDAO.GetEbill(billId, period);
   // Get data (returns EbillData object with EbillDetailDataSet & EbillAgingDataSet)
EbillData data = EbillDataDAO.GetData(billId);
   // Set output .xls file path & file name
string filePath = GetEbillFilePath(period);
string filePathAndName = GetEbillFilePathAndFileName(b.billName, period);
string templateFile = ConfigurationSettings.AppSettings[“ExcelTemplateFilePath”];
   // Load Aspose License
string key = ConfigurationSettings.AppSettings[“AsposeExcelLicense”];
if (key != null && key.Length > 0) {
Aspose.Excel.License license = new Aspose.Excel.License();
   // Create new Aspose.Excel object, and open the template file
Excel excel = new Excel();
   // Declare Cells class
Aspose.Excel.Cells cells;

// Create worksheet
Worksheet wsDetail = excel.Worksheets[0];
cells = wsDetail.Cells;
   // Declare counter
i = 1;
int detailColumns = 18;
   foreach(EbillDetailDataSet.DetailDataItem item in data.detailData.DetailDataItems) {
   // Autofit all columns
for (int k=0; k<=detailColumns ; k++) {
   // Make sure directory exists, if not create it
if (!Directory.Exists(filePath))
   // Save file

It seems a problem of file size. We will check and fix it ASAP. Thanks for your patience.

It’s fixed. Please download and try v3.4.4 at .

Excellent. It worked!

Thanks for the excellent support. Great product.