Home > Net >  C # excel in the dataset
C # excel in the dataset

Time:10-06

Because excel header in line 5, the first few lines removed header is how to define the line 5, thank you

CodePudding user response:

Generally I is used for the operation of the Excel npoi

CodePudding user response:

Or directly from line 5 to start import
the dataset?

CodePudding user response:

Two way
First use the oledb read and then assign values to the Table of the DataSet,
The second to the Row directly with ApplicationObject [] [] assignment,

CodePudding user response:

The most brutal way is to read all the excel data in the datatable and think of how to operate the datatable is how to operate,

CodePudding user response:

NPOI
 
Var file=new FileStream (Url, FileMode. Open, FileAccess. Read);
Var wb=new XSSFWorkbook (file);
Var Sheet=wb. GetSheet (" Sheet1 ");
Var RowCount=Sheet. LastRowNum;
for (int i=1; i {
Var Row=Sheet. GetRow (I + 4);
Row. GetCell (). The toString ();//get columns
Row. GetCell (). The toString ();//get columns
}

CodePudding user response:

When I import excel are directly with the drive and then directly as essentially a query sheet1, this is similar to a lookup table, if like you said, I think you can try to order by a try, anyway, I didn't try the order by directly query, or you direct all queries and then from the fifth line operations
  •  Tags:  
  • C#
  • Related