Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Row count with SpreadsheetLight

I'm looking for a function similar to DataTable.Rows.Count that can be used with an SLDocument to find out how many rows have data in them. Is there something available in SpreadsheetLight? Any other methods of achieving this?

-Brendan

like image 944
Brendan Gates Avatar asked Jul 09 '15 18:07

Brendan Gates


People also ask

How do you get a row count?

The SQL COUNT() function returns the number of rows in a table satisfying the criteria specified in the WHERE clause. It sets the number of rows or non NULL column values. COUNT() returns 0 if there were no matching rows.

What is SpreadsheetLight?

SpreadsheetLight is an open source Open XML spreadsheet library for . NET Framework written in C#, and is released under the MIT License.

What is counted by RowCount?

@@RowCount is a system variable which will have the value of last executed query's number of rows affected. It is used after any type of query such as 'insert', 'Update', 'Delete'. So, @@RowCount is used to check number of rows affected only after a query execution.


1 Answers

SLWorksheetStatistics stats1 = firstdoc.GetWorksheetStatistics();


for (int j = 1; j < stats1.EndRowIndex; j++)
{
    var value = firstdoc.GetCellValueAsString(0, j)  ;

}
like image 165
bh_earth0 Avatar answered Sep 23 '22 13:09

bh_earth0