Free Support Forum - aspose.com

Opening OpenXml file generated by EPPlus

Hi,

I generated an Excel spreadsheets in OpenXml format using EPPlus. When I try to open it using Aspose.Cells, the program returns the following error:

Aspose.Cells.CellsException: ‘Invalid cell name’

I believe the cells didn’t find the correct file format.

How can I open this file?

I am using C# and .NET Core

Thanks

@andreventu,

Thanks for your query.

I have tried the scenario using following sample code but no problem is observed as spreadsheet created by EPPlus is successfully read by Aspose.Cells.

Please share your sample file and code snippet with us for our testing. We will reproduce the problem and provide our feedback after analysis.

Following is the sample code which is used for testing:

using System;
using System.IO;
using OfficeOpenXml;

namespace AsposeCells
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Creating XLSX file using EPPlus");
            CreateExcelFileInEpplus();
            Console.WriteLine("Success in creating XLSX file using EPPlus");
            ReadExcelFileUsingAsposeCells();
            Console.WriteLine("Success in reading XLSX file using EPPlus");
        }
        static void CreateExcelFileInEpplus()
        {
            var newFile = new FileInfo("output.xlsx");
            if (File.Exists(newFile.Name))
                File.Delete(newFile.Name);
            using (ExcelPackage xlPackage = new ExcelPackage(newFile))
            {
                xlPackage.Workbook.Worksheets.Add("Sheet1");
                // do work here                            
                xlPackage.Save();
            }
        }
        static void ReadExcelFileUsingAsposeCells()
        {
            Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook("output.xlsx");
            Console.WriteLine(workbook.Worksheets[0].Name);
        }
    }
}

Screen Shot 2018-08-03 at 6.45.39 AM.png (597.1 KB)
output.zip (2.1 KB)

Hi,

Thanks for reply.

I made an example program and attached the xlsx generated by EPPlus in OOXML format.

If I open it in Excel, it opens.
If i open it in Excel and save it again, Aspose can open it.
But if I try to open it directly on Aspose, I get the error.

FinanceiroAnalitico.zip (3.4 KB)

Thanks

@andreventu,

You have shared XLSX file only but it is not sufficient to re-produce the issue as we need the sample code as well which is used to create this XLSX file using EPPlus. Please share simple console application which is used to create this XLSX file for our testing here. Also mention the .NET core version and Aspose.Cells version which is used for testing.

This XLSX raises exception while opening in Excel 2016 where it asks for recovering the file and this file is also read only. You may send us the code to create this file here and provide our feedback after analysis.

@ahsaniqbalsidiqui

I found the error: I called the method FreezePanes(2, 1) of EPPlus with invalid column argument. This caused an invalid value in xlsx (what you referenced in previous reply). I corrected the mistake and all worked ok.

Thanks

@andreventu,

Good to know that your issue is sorted out. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.