Can anyone please help me understand why datatable returns blank output for zero records. I was expecting it to return “0” FOR DT.ROWS.COUNT but my message box is displaying blank value.
I don’t have any idea as to why it is blank. As per my code, it should return zero as there are no rows in the excel sheet
Tested a few instances with Read Range inside Excel Application Scope and it is working fine for me.
Can you check if the dt is not empty? i mean if the excel was not read properly?
Maybe share a bit of insight or screenshots on how the dt is getting populated.
I was playing around with your scenario but am not able to replicate your issue the same way.
Even if I read a sheet which has all empty cells and not even a header, I still get the dt.rows.count as 1 (might be an issue. Planning to initiate a new topic with proper details. Waiting for this thread to go on).
But even then I dont get row count as blank!
Try debugging a bit. Use Output Data Table activity to store the DT in a variable and display it using Write Line.
To be on the same page, hope you too are using Read Range activity within Excel Application Scope. Also am trying this on .xlsx file, with Excel 2016. Not sure if that matters. Just in case…
You mean to say, even without any records or headers in Excel sheet, does the row count return as 1? Moreover what is the difference between having two separate excel application scope under a sequence and one excel application scope inside the other?
The variable have scopes have been declared at the global level
Excel Application Scope is more of a container like an Attach Window activity. Whatever actions you do within that container gets performed on the sheet in the scope.
I am not sure how efficient / advisable it is to use Excel Application Scope within another, though it might work. I would have used two separate containers rather than complicating it, until really necessary.
Can you please check your variable scope. May be two variable with same name have been declared, One in Global Scope and one in Excel Application Scope. If So, then delete the variable declared in Excel Application Scope. It should work.