I'm trying to read an excel file from the input Stream.
I want to read line by line and save the column information from Excel to Database.
I'm unable to read the file, Can any one help me to figure out what Im missing.
Here is the code below.
using (System.IO.BinaryReader sr = new System.IO.BinaryReader(fileToUpload.PostedFile.InputStream))
{
do
{
tester.Text = tester.Text + sr.ReadString() + "</br>";
} while (sr.PeekChar() > 0);
}
Thanks karthik
Normally, in text file, we read line-by-line. I doubt whether Excel also brings data line-by-line (or) you will be able to recognize End-of-line character. If you correlate Excel's row as line, that could be wrong. May be you can try with CSV file, which can be read line-by-line and can be processed as individual lines.