Relative Content

Tag Archive for c#excelepplus

Getting extra null rows when I am trying read excel file with EPPlus OfficeOpenXml

I am having an excel file with 4 sheets. However, it is behaving incorrectly when I am reading the first sheet in my C# (.NET Core 3.1) code. The sheet has around 350-450 entries, sometimes it reads only 4 empty rows and at times the 450 rows but still 4 extra empty rows. Then I deleted a few empty rows from the end so it starts reading correctly.
This is the code I am using –

EPPlus Pivot table date grouping not formatting correctly

I have a pivot table created using EPPlus. The data is basic sales information, with a date, item name and total.
The Pivot table contains the name and date in the row with total summed. It also groups by date so can drill into sales by date.
This all works fine, the problem being the date grouping gets sorted as string value and not date. The dates are stored as Excel dates (so internally as numbers).
When spreadsheet is opened in Excel the date group sorting will not change even if pivot table is refreshed or sort order changed.
The only way to force sort change is to: