question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spreadsheets are empty when opening in "Spreadsheet compare" Office tool

See original GitHub issue

Hello! First of all, thank you for the amazing tooling, metrics are really great and writes are so performant! I’m able to generate large xlsx files using .NET.

However, I have faced the issue when trying to compare the file generated with SpreadCheetah, with other xlsx files using the Spreadsheet Compare 2016 tool (part of Office). The file generated using SpreadCheetah is treated as empty for some reason by this tool, so I can’t compare it with others. At the same time, the file in Excel looks good and has the data. I had no similar issue when opening files created using NPOI package.

So, is it possible to make the SpreadCheetah-generated xlsx files compatible with Spreadsheet Compare? Could you please let me know if you can plan it, so that I can realize whether I can fully migrate to SpreadCheetah?

This is how the issue looks like in Spreadsheet Compare (left file that looks empty - SpreadCheetah, right file - created in Excel): image

This is how the file looks like in Excel - it’s not empty: image

Minimal code:

using var tempStream = new MemoryStream();
await using var spreadsheet = await Spreadsheet.CreateNewAsync(tempStream, null, cancellationToken);
await spreadsheet.StartWorksheetAsync("Report", null, cancellationToken);

var columnNames = new List<string> { "column1", "column2" };
var values = new List<string> { "value1", "value2" };

var headerRow = new List<Cell>();

foreach (var columnName in columnNames)
{
     headerRow.Add(new Cell(columnName));
}

await spreadsheet.AddRowAsync(headerRow, cancellationToken);

var valuesRow = new List<Cell>();
foreach (var value in values)
{
    valuesRow.Add(new Cell(value));
}
await spreadsheet.AddRowAsync(valuesRow, cancellationToken);

await spreadsheet.FinishAsync(cancellationToken);

Environment: Spreadcheetah 1.9.0 .NET 6

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sveinungfcommented, Mar 25, 2023

It seems this is due to SpreadCheetah not writing the explicit cell reference for each cell. In an XLSX file, each cell element can have an explicit reference (or "r") attribute. According to the Open XML specification this attribute is optional, but it seems it is required for Spreadsheet Compare to do a comparison. SpreadCheetah doesn’t write this attribute to achieve better performance, but I’m considering adding an option to write this attribute, something like SpreadCheetahOptions.WriteCellReferenceAttributes. The option would default to false so that performance wouldn’t be affected for users that don’t need this feature.

1reaction
sveinungfcommented, Mar 21, 2023

Hi, and thanks for the feedback!

Not sure what is causing this issue, but I can look into it. In the meantime, if you open the file created by SpreadCheetah in Excel, and then save the file from there, does it still show up as empty in Spreadsheet Compare?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Excel opens a blank screen when you double-click a file ...
In this article Symptoms Resolution Option 1: Check for hidden sheets Option 2: Minimizing and maximizing the window Option 3: Disable hardware acceleration...
Read more >
7 Ways to Fix Excel Opening a Blank Document
7 Ways to Fix Excel Opening a Blank Document · 1. Check the File · 2. Unhide the Sheets · 3. Refresh Microsoft...
Read more >
FIX!!!! Microsoft Excel opening a blank document - YouTube
You can easily fix Excel file blank issue by using Stellar Repair for Excel software.
Read more >
Excel taking too long to open
Method 1: Install Office Update. Open Excel. Click on File. Go to Account. Under Product Information, choose Update Options and click Update Now ......
Read more >
[Solved] Excel Spreadsheet Disappears after Opening
The Excel file opening a blank screen problem may occur if the file associations are not performing correctly. Solution: Reset Excel File ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found