Hello everyone!
I have a project as to read the Excel file and load into mySQL database, but my coding is to read only 100 first rows, how can we read all rows from .XLS sheet. Please, anyone can help me. Thanks a lot in advance. my coding as below:
for (int row = 1; row <= document.WorkBo ok.Worksheets[0].LastRow; row++)
{
// And column in first Worksheet
for (int col = 0; col <= document.WorkBo ok.Worksheets[0].LastColumn; col++)
{
// Append cell value to StringBuilder
builder.AppendF ormat("{0}\t", document.WorkBo ok.Worksheets[0].Cell(row, col).Value );
//
}
builder.AppendL ine();
}
// Save StringBuilder to file
File.WriteAllTe xt("C:\\MINH.tx t", builder.ToStrin g());
I have a project as to read the Excel file and load into mySQL database, but my coding is to read only 100 first rows, how can we read all rows from .XLS sheet. Please, anyone can help me. Thanks a lot in advance. my coding as below:
for (int row = 1; row <= document.WorkBo ok.Worksheets[0].LastRow; row++)
{
// And column in first Worksheet
for (int col = 0; col <= document.WorkBo ok.Worksheets[0].LastColumn; col++)
{
// Append cell value to StringBuilder
builder.AppendF ormat("{0}\t", document.WorkBo ok.Worksheets[0].Cell(row, col).Value );
//
}
builder.AppendL ine();
}
// Save StringBuilder to file
File.WriteAllTe xt("C:\\MINH.tx t", builder.ToStrin g());
Comment