Free Support Forum - aspose.com

Aspose.cells 18.5.0 cannot read the xlsx extension in .net core console 2.0

Hi Support,

I am trying to read a excel with extension .xlsx but I get invalid content in .net core console 2.0 project So Could you explain me which code Does I need to add in order to read the extension .xlsx, please? when you have time,please.
the current code that I am using is the following:

TxtLoadOptions opts = new TxtLoadOptions(LoadFormat.Auto);
        using (Workbook wb = new Workbook(@"D:\Database Import\Book_test_1.xlsx", opts))
        {
            Worksheet ws = wb.Worksheets[wb.Worksheets.ActiveSheetIndex];
            Row row = ws.Cells.GetRow(0);
            for (int colIndex = 0; colIndex <= ws.Cells.MaxDataColumn; colIndex++)
            {
                Console.WriteLine(row.GetCellOrNull(colIndex).StringValue);
            }
            for (int indexRow = 1; indexRow <= ws.Cells.MaxDataRow; indexRow++)
            {
                row = ws.Cells.GetRow(indexRow);
                for (int colIndex = 0; colIndex <= ws.Cells.MaxDataColumn; colIndex++)
                {
                    Console.Write(row.GetCellOrNull(colIndex).Value);
                    Console.Write(',');
                }
                Console.WriteLine();
            }
        }

When I ran this code in dot net core console. 2.0 the output is the following:
image.png (16.5 KB)

the .xlsx file that I am using is the following:

Book_test_1.zip (8.0 KB)
image.png (5.9 KB)
image.png (4.0 KB)

thanks,
Luis F. Camacho

@luis_camacho,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46445 - Cannot read the XLSX extension in .NET Core console 2.0

@luis_camacho,

Please remove TxtLoadOptions opts = new TxtLoadOptions(LoadFormat.Auto) from your code. If the LoadOptions is TxtLoadOptions , the API processes the file as TXT file which results in corrupted value.