.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

some of the cell value cant read from Excel

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :ASP.Net
Hi all, Im reading some data from the excel file, using below code objBusy = new BusinessLogic();                string strFileName = FileUpload1.PostedFile.FileName;                string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + strFileName + ";" + "Extended Properties=Excel 8.0;";                OleDbConnection objConn = new OleDbConnection(connectionString);                objConn.Open();                String strConString = "SELECT * FROM [Product1$]";                //where date = CDate('" + DateTime.Today.ToShortDateString() + "')";                OleDbCommand objCmdSelect = new OleDbCommand(strConString, objConn);                // Create new OleDbDataAdapter that is used to bui

View Complete Post

More Related Resource Links

Read/Write Excel file with formulas and accessing cell ranges


I need to read and write data to some specific cells in an excel file.
I want to send some values to cells from front end i.e asp.net web page and after calculation from excel the value should be send again to asp.net

Example if cell A1 = 10 Cell B1 = 20 then C1 cell should have value of A1 + B1 i.e 30 should be displayed and this cell C1 value should be fetched and displayed in ASP.NET Page or some front end

Secondly is it possible to use formula and ranges from asp.net

Read Excel file from Web Application (C#)



I have a web app where user uploads a file.

File is saved in server locally and I want to read some data from it.

Currently my development  server has office 2003.

So do I need office 2007 in order to be able to  read an excel from office 2007 ?

What are other requirements  ?

I tried a test, using

Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook wrkBook; // = new Microsoft.Office.Interop.Excel.Workbook();

wrkBook = excelApp.Workbooks.Open(@"C:\www\excel_files\b.xls", ....);

But When trying to open the file I get the error:

Exception from HRESULT: 0x800A03EC

So I'm wondering what I'm missing.


How to read value of CheckBox in EXCEL sheet


I am using OLEDBConnection (@"Provider=Microsoft.ACE.OLEDB.12.0;") to connect to the EXCEL file and read contents. When I read the contents, I get all the contents from the excel sheet but i dont get contents for checkboxes placed inside.

My Excel sheet contains set of checkboxes and I need to know If they are checked or not.These checkboxes are controls which are added from Developer tab in EXCEL.

I dont want to use Excel Assemblies for reading contents as it is not recommended. And also i am using OLEDBconnection and want to stick to this .

Awaiting replies from you guys. Thanks in Advance.

How to read Excel table?


If I  use Microsoft.Jet.OLEDB.4.0 to retreive for example named range or sheet from Excel and use it as data source for some server control on the ASP page, everything works fine. But when I try to get table from Excel like this: "select * from [Table1]", debugger complains that database engine could not find object Table1. So how should I reference Table1 in Excel file so that the database engine could find it?

Passing Data to a Cell in Excel



I have a webpage that is created in Visual Studio 2008 and programmed in C#.

I have a web form that prompts the user to enter a value into a text box.  For now, I do not have any validation on that field (I will be adding that later).

I need to pass the value that the user has entered to cell C1 of the excel spreadsheet (user_info.xls).

I understand that using excel is not ideal, but unforutnately need to try to make this work with the excel spreadsheet.

I do not have any code for this yet, because I honestly do not know how to begin.

The action of poulating the excel spreadsheet will be intialized from the On Click event of a Submit button.

Any suggestions would be much appreciated.

Thank you in advance for your assistance,


Read Excel sheet by Sheet Name using office interop

Hi,I am using office interop to read Excel sheet.I want to read the contents of the sheet  using the name of the sheet.For example I want to read the contents of the sheet- "ABC" (if ABC exists).Thanks

Enhance SSAS so that a calculation returns multiple cells at once (Excel fill not a single cell but

I wonder if somebody can help me with the following question. I would like to create an enhancement to SSAS in a way so that one can pass in multiple values, run a calculation and in return retrieves not one but multiple cell results at the same time e.g. retSet = functionABC(inSET) where inSet is somthing like 5 4 3 6 7 3 4 4 AND retSet is 4 6 7 8 9 3 4 4 All my calculated members in MDX return a single value BUT I need to have a calculation that if called returns multiple results (a set) at once and in a way so that Excel will properly pick up on it and consequently fills multiple cells in the Pivot table. Is that possible at all and if so how? I would not mind to write a little CLR assembly to enhance the SSAS but don't know how to pass the results back. Any ideas are highly appreciated. Dirk

read data from excel

hi all,i had 2 columns in the excel file one is SNo and another Descriptionlooks like belowSno                         Description1                              1/2 Feet2                               1/5 Feet3                              204                               30i read the data from this file using below codestring strFileName = FileUpload1.PostedFile.FileName;            string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + strFileName + ";" + "Extended Properties=Excel 8.0;";            OleDbC

How to update single cell of excel sheet using oledb connection,

 Friends i got some codes from net  by using that i can update a excel sheet ,but there we have to specify some header fields name in command string like as fallows ,Update [Sheet1$] set ProductName="IBG" where ProductId=5but i want to update a single cell of excel sheet only,let say O12 cell i want to change somedata,how it is possible that i don't know.plz help me out... thanks in advance...  

How to read excel header name and put into SELECT statement?

Hi,        I'm trying to read Excel file header column name. Then I can query data from excel using SELECT statement. For instance. column name is name, department and email.  Then I want this three header name being detected using code and put in select statement. User no need to care about the header name and we can use code to read the header name instead of hardcode header name inside SELECT statement.       Please provide the details. Thanks.

Reading Excel Spreadsheet from Cell A7

I don't know a lot about SSIS.  I have an excel spreadsheet where cell A1 and A2 have varchar values and B1 and B2 have decimal values.  Rows 3, 4, and 5 are blank.  Row 6 has the header column names and the data itself starts in A7 through F7.  I am not interested in rows 1 through 5.  The data ends in row 44.  Row 45, 46, and 47 are blank and in cell D48 it has the comment End of Report.  I am only interested in loading A7 through F44.  I do not know if the row count could grow or if it always stays at line 44.  Is there a way to tell SSIS to skip the first 5 rows, read the 6th row as the header and to start loading from A7?lcerni

read excel column value

Hi All,             i am uploading excel file data to database.Excel column value is combination of text and time,i need to extract only time.Each column will have different value. One column value is   _immediate 17:00 - 9:00 another column value is EMAIL 09:30 - 18:00,another column value is CKA 09:30 - 18:30 ans so on. i need to extract only time and store it 2 different variables like this. string Intime - 17:00 string OutTime - 9:00   Please send me code to acheive this task.            

How to read an Excel file and show data from 2 columns

Hi,I have an Excel file called Products.xls .I have Columns A and B, with the titles NAME and QUANTITY.The name of the sheet is SHEET1.The file has about 40 lines.How do i show these data on a Gridview or Listview ?Thank you.

Use Report Action as default drillthrough on a calculated cell in Excel

Hi, I am using SSAS 2008 R2 and Excel 2010. Is there a way to override the default behavior from the cube to force an excel pivot table to perform a report action rather than a drillthrough when I double click a cell that is a calculated member? Currently, I get an error message. Truth be told, I wouldn't mind making all the double clicking in my pivot table cells pop a report for the user since the drillthrough formatting is so primitive, but I really need to know how to do it for the calculated cells. Thanks, James

Document is read-only in SharePoint, but user sees "check out" option in Office 2007 / Word / Excel

I am finding that when there is a document library in SharePoint with checkin/checkout required, if a user with read-only ("Visitor") permissions opens a document from that library, the document will open as read-only in Word, Excel, etc., but the user will see the "Server Document" bar with the message "To modify this document, you must check it out" and the "check out" button.  When the user tries to check the document out, they are asked to authenticate, and then receive the error "Cannot perform this operation.  The file has been deleted or someone else has it checked out."    How is it possible to prevent a user with read-only rights in SharePoint from seeing the "Check out" option in Word or Excel?

How to import excel cell value preceding with '00'



        I am trying to import an excel file in SQL Server 2005 through "OPENROWSET" command.But the problem is in excel there is a column with cell values preceding with '0's.e.g. '000987','000008' etc..the excel file has rows more than a lakhs so manually edit each row is absurd. but while I'm trying to import the data its getting values without the preceding '0's....So please suggest me how do I import the data through SQL Server scripting...


Read write excel


Hi again,


I am having problems in manipulating excel files in vs2005.

All I want is to get the excel files(this excel has specific design for reporting and has macros in it), read it, add data for reporting purpose, and make that file send to the client.

Now, the problems I encountered and will encounter is:

1. It has password protect, I dont know how to unprotect it. I already use sheet.Unprotect("password here") but no use.

2. Actually I cant read this using Microsoft.Interop method.

3. Call every sheets I want to be updated. 

4. Update the cells with data from database(getting database data is easy of course)

5. Optional, protect it again.

6. Send it to client(downloading)


That's all I need.


Many thanks for the help.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend