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.

Getting empty worksheets in workbook created from datatables.

See original GitHub issue

Read and complete the full issue template

Do not randomly delete sections. They are here for a reason.

Do you want to request a feature or report a bug?

  • Bug
  • Feature
  • Question

Did you test against the latest CI build?

  • Yes
  • No

If you answered No, please test with the latest development build first.

Version of ClosedXML 0.95.3

What is the current behavior? workbook is created with worksheets using fully populated datatables. Worksheets are created with the correct number of columns and rows, but no data from the datatables is being populated into the worksheet cells. Columns are only labled as Column1, Column2, Column3 etc… Worksheets do have the correct names from the datatable names. While debugging I an view the datatable data from the Visual Studio visualizer. The table data looks well-formed. (https://github.com/ClosedXML/ClosedXML/files/5063907/Daily_Reports_12-08-2020_09-32.xlsx)

What is the expected behavior or new feature? data from data tables to be populated in the worksheets of workbook.

Is this a regression from the previous version?

Regressions get higher priority. Test against the latest build of the previous minor version. For example, if you experience a problem on v0.95.3, check whether it the problem occurred in v0.94.2 too.

Problem also occurs in v0.95.2.

Reproducibility

This is an important section. Read it carefully. Failure to do so will cause a ‘RTFM’ comment.

Without a code sample, it is unlikely that your issue will get attention. Don’t be lazy. Do the effort and assist the developers to reproduce your problem. Code samples should be minimal complete and verifiable. Sample spreadsheets should be attached whenever applicable. Remove sensitive information.

Unfortunately I am not able to include actual data from the datatable…

public void Main()
{
public XLWorkbook ExportExcelFiles(string checkedReportsString)
        {           
            using (var wb = new XLWorkbook())
            {
                //find each report id in the url parameter sting and create and excel workbook with a worksheet for each one
                string reportId = null;
                foreach (char c in checkedReportsString)
                {
                    
                    //find the next report id in url parameter string and create an excel worksheet from it
                    if (c != char.Parse("~"))
                    {
                        reportId = reportId + c;
                        continue;
                    }

                    else if (c == char.Parse("~"))
                    {
                        //create datatable of the current report
                        string reportName = GetReportTableName(reportId);
                        DataTable reportDataTable = GetTableData(reportId, reportName);
                        
                        //add datatable to workbook                                                
                        if (reportDataTable != null && reportDataTable.Rows.Count > 0)
                        {
                            reportDataTable.TableName = $"{GetReportTableName(reportId).Substring(7)}_{GetReportDateStringWithTime(reportId)}";                            
                            var ws = wb.Worksheets.Add(reportDataTable);                            
                        }
                        reportId = null;
                    }
                }
                if (wb != null) return wb;
                else throw new Exception("No Data to Report");

                
            }             
        }
}
  • [x ] I attached a sample spreadsheet. (You can drag files on to this issue)

[Daily_Reports_12-08-2020_09-32.xlsx] testWorkbook.xlsx

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
vbjaycommented, Aug 18, 2020

Sure thing.

On Tue, Aug 18, 2020, 6:38 PM Francois Botha notifications@github.com wrote:

@tysongibby https://github.com/tysongibby Can you not recreate your Oracle dataset based on dummy values, but still reproducing the error?

@vbjay https://github.com/vbjay I’ve made very snarky in the past myself and I regret that, but I’m trying to be a better person now. Let’s try to be more welcoming. Because we definitely need more help with the project here. Don’t want to scare people away.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ClosedXML/ClosedXML/issues/1491#issuecomment-675754156, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3WDMJ4P6XCINSNDFGJDDLSBL7GXANCNFSM4P44YKUQ .

0reactions
igiturcommented, Aug 28, 2020

Fixed in #1499

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Export DataTable to Excel Sheet - Getting Empty Rows ...
Export DataTable to Excel Sheet - Getting Empty Rows When Creating ... This increases the blank row as each remaining table is built....
Read more >
Excel is Empty but DataTable output is blank when queried ...
First create a new excel/csv file. Then you ll need to use new datatable (with View column) to append the data to excel/csv...
Read more >
CreateDataTableExporter leads always to an error if some ...
Now, I want to convert this worksheet to a decent DataTable in C#, ... DataTable there will be an automatically generated empty "Column4", ......
Read more >
Uipath || Create Empty Excel File Using DataTable - YouTube
This video shows , how we can use DataTable Activity to create an Empty Excel File in UiPath #uipath # datatable.
Read more >
excel
Option to instruct the Excel export to create empty cells. By default if a cell contains null or empty data, it will not...
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