473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

working with .xls (excel) files

Hi! Does anyone know how to open excel (.xls) file (and read data from it)? I
tryed to do it using oleDb, but it falied.
Nov 16 '05 #1
5 4296
Set a COM reference to "Microsoft Excel #.# Object Library", and then create
and use an instance of the Excel.ApplicationClass object.
"menkaur" wrote:
Hi! Does anyone know how to open excel (.xls) file (and read data from it)? I
tryed to do it using oleDb, but it falied.

Nov 16 '05 #2
See http://www.dotnetspider.com/technology/KBPages/361.aspx

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #3
Thenks for info.
But i still have problems with reading data: i can't convert
Worksheet.Cells[x,y] to eny known types. typeof says, the type of returned
object is System.__ComObject. This type and Variant are protected System
members. Do You know, what type shood be used here?

An other problem: how to terminate created Excel.Application after i do not
need it? - it stays in memory even after application closes.
Nov 16 '05 #4
Try getting the Value property and casting it to what value you think it
should be. Leave it as object (or string) if you don't know.
e.g.
Excel.Worksheet shtData;
....
int i = (int)shtData.Cells[x,y].Value;
string s = shtData.Cells[p,q].Value.ToString();
object o = shtData.Cells[r,s].Value;

"menkaur" <me*****@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
Thenks for info.
But i still have problems with reading data: i can't convert
Worksheet.Cells[x,y] to eny known types. typeof says, the type of
returned
object is System.__ComObject. This type and Variant are protected System
members. Do You know, what type shood be used here?

An other problem: how to terminate created Excel.Application after i do
not
need it? - it stays in memory even after application closes.

Nov 16 '05 #5
Thenks for help.

May be you know how can i shoot down EXEL.exe process after i've finished
working with it. In ceps beeng in memory after Excel.ApplicationClass object
is destroyed.
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Rich | last post by:
Hi, I have a bunch of Excel reports that I would like to display on my company's intranet. The reports contain priviledged information, however. My plan was to have a page with a dropdown box...
3
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
0
by: Oci-One Kanubi | last post by:
Everything works fine in Access, but when I double-click on the resultant Excel files the first one opens correctly, but subsequent ones, and any other Excel files I try to open, fail to display at...
2
by: Ronny Sigo | last post by:
Hello all, As one of a few ways to let a user bring in data into my database I have made 3 excel files. Once the data are in the excel files my program checks if a required value (Taal (Dutch)...
0
by: Jack | last post by:
Windows 2K Pro Access/Excel 2003 Hi there, I have a large number of password protected Excel Workbooks. The files are protected by code that runs when the workbook opens. The code asks the...
0
by: Rich Wallace | last post by:
Hello all, Looking for suggestions and tips if possible. I have an application running on a file server that utilizes the FileSystemWatcher to trap when any Excel files are saved by a user. I...
0
by: Broun | last post by:
Hello Am new to C# and i would like to provide for the following web services from MS Excel. Allow clients to upload their excel files to a server in xml format so they can be integrated into a...
18
by: gonzlobo | last post by:
No, I don't want to destroy them (funny how the word 'decimate' has changed definition over the years) :). We have a data acquisition program that saves its output to Excel's ..xls format....
1
by: chrspta | last post by:
I am new to Visual basic. I need a program using VB6 that converts txt files to excel file.Description is in the below: The form should have the Drive list, Dir list, file list and cmdConvert...
5
by: Doogie | last post by:
Can anoyne tell me why this VBScript will create the file to Excel just fine, but the Excel file will not open up? I am saving it as a xlsx file instead of an xls one and I have the new version of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.