Reading an Excel File

Hi,

    I want to read a MS Excel file. The Excel file is not in tabular format 
to use ODBC.

    Could you please advice me how to read the data from an Excel file?


Thanks in Advance.,
Ram 


0
ram_naga (5)
5/28/2008 6:12:56 AM
vc.mfc 33608 articles. 0 followers. Follow

9 Replies
1591 Views

Similar Articles

[PageSpeed] 14

Ram avait soumis l'id�e :
> Hi,
>
>     I want to read a MS Excel file. The Excel file is not in tabular format 
> to use ODBC.
>
>     Could you please advice me how to read the data from an Excel file?
>
>
> Thanks in Advance.,
> Ram

See :
http://www.codeproject.com/KB/database/cspreadsheet.aspx

http://www.codeproject.com/KB/office/Excel_DataReader.aspx

http://www.codeproject.com/KB/office/BasicExcel.aspx

for example ...


0
none89 (807)
5/28/2008 8:37:35 AM
Ram vient de nous annoncer :
> Hi,
>
>     I want to read a MS Excel file. The Excel file is not in tabular format 
> to use ODBC.
>
>     Could you please advice me how to read the data from an Excel file?
>
>
> Thanks in Advance.,
> Ram

More genrally, see : 
http://www.codeproject.com/info/search.aspx?artkw=read+excel+file


0
none89 (807)
5/28/2008 8:47:00 AM
"Ram" <ram_naga@yahoo.com> ha scritto nel messaggio 
news:g1it5a$eev$1@daniel-new.mch.sbs.de...

>    I want to read a MS Excel file. The Excel file is not in tabular format 
> to use ODBC.
>
>    Could you please advice me how to read the data from an Excel file?

I think that Excel exposes a COM OLE Automation interface.
So, you may consider using that interface to read Excel files from C++.
Both MFC and ATL offer helper classes for that purpose (COleDispatchDriver 
is one of them for MFC, IIRC).

BTW: On Joe's site there is an essay in which he uses MFC and OLE Automation 
to interact with another app of the Office suite: Power Point.

http://www.flounder.com/powerpoint_indexer.htm

Giovanni


0
5/28/2008 9:50:03 AM
Something worth noting.  Office 2007 uses a new XML format for documents.  I 
don't know which version you are reading, but the XML version may be easier 
to deal with:

http://blogs.msdn.com/brian_jones/archive/2005/06/27/433152.aspx

Tom

"Ram" <ram_naga@yahoo.com> wrote in message 
news:g1it5a$eev$1@daniel-new.mch.sbs.de...
> Hi,
>
>    I want to read a MS Excel file. The Excel file is not in tabular format 
> to use ODBC.
>
>    Could you please advice me how to read the data from an Excel file?
>
>
> Thanks in Advance.,
> Ram
> 

0
tom.nospam (3240)
5/28/2008 1:00:33 PM
On May 28, 2:12 am, "Ram" <ram_n...@yahoo.com> wrote:
> Hi,
>
>     I want to read a MS Excel file. The Excel file is not in tabular format
> to use ODBC.
>
>     Could you please advice me how to read the data from an Excel file?
>
> Thanks in Advance.,
> Ram

You can export this file in csv format and read it as needed or you
can use Automation as all office products expose the object model.
Keep in mind that using automation requires using COM, which is not
trivial. If you choose to use automation, usign VB6 or .Net would be
easier alternatives than using COM in unmanaged C++.

--
Ajay
0
ajaykalra (6841)
5/28/2008 1:37:34 PM
Thanks for you suggestions,

    I found the below link is very useful and the library it provides it 
good.

http://support.microsoft.com/kb/308407/en-us


Thanks
Ram


"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message 
news:8bf1f83f-bc7a-46a9-8eb4-64ae5e218cc1@8g2000hse.googlegroups.com...
> On May 28, 2:12 am, "Ram" <ram_n...@yahoo.com> wrote:
>> Hi,
>>
>>     I want to read a MS Excel file. The Excel file is not in tabular 
>> format
>> to use ODBC.
>>
>>     Could you please advice me how to read the data from an Excel file?
>>
>> Thanks in Advance.,
>> Ram
>
> You can export this file in csv format and read it as needed or you
> can use Automation as all office products expose the object model.
> Keep in mind that using automation requires using COM, which is not
> trivial. If you choose to use automation, usign VB6 or .Net would be
> easier alternatives than using COM in unmanaged C++.
>
> --
> Ajay 


0
ram_naga (5)
5/29/2008 7:51:38 AM
"Ram" <ram_naga@yahoo.com> wrote in message 
news:g1lnaq$kpi$1@daniel-new.mch.sbs.de...
> Thanks for you suggestions,
>
>    I found the below link is very useful and the library it provides it 
> good.
>
> http://support.microsoft.com/kb/308407/en-us

Thats using automation(COM) and its good if you can use it. CSV reading is 
relatively easier.

--
Ajay



0
ajaykalra (6841)
5/29/2008 2:06:18 PM
The one obvious problem with using a COM solution is that the Excel program 
will have to be on every system where you want to read a spreadsheet.  Any 
system can read a CSV file since it's just an ASCII file.

Tom

"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message 
news:BC299B97-7F60-4C71-AC0E-86122DAA8458@microsoft.com...
>
> "Ram" <ram_naga@yahoo.com> wrote in message 
> news:g1lnaq$kpi$1@daniel-new.mch.sbs.de...
>> Thanks for you suggestions,
>>
>>    I found the below link is very useful and the library it provides it 
>> good.
>>
>> http://support.microsoft.com/kb/308407/en-us
>
> Thats using automation(COM) and its good if you can use it. CSV reading is 
> relatively easier.
>
> --
> Ajay
>
>
> 

0
tom.nospam (3240)
5/29/2008 3:17:15 PM
"Tom Serface" <tom.nospam@camaswood.com> wrote in message 
news:8EFF20C6-9C7E-4241-AFC6-F54602C2509D@microsoft.com...
> The one obvious problem with using a COM solution is that the Excel 
> program will have to be on every system where you want to read a 
> spreadsheet.  Any system can read a CSV file since it's just an ASCII 
> file.

Thats a good point.
--
Ajay

0
ajaykalra (6841)
5/29/2008 4:23:39 PM
Reply:

Similar Artilces:

Inserting text from a .txt file
I'm trying really hard to jump on the bandwagon and migrate from Outlook Express to Outlook, but the more I try, the more frustrated I get. Anyway, here is my question: How do I insert the text from a text file into my e-mail document. I am using the rtf editor. thank you, ~alan copy/paste? "~~Alan~~" <alan.shepro_NOSPAM@verizon.net> wrote in message news:%23%23AwZrIKEHA.1264@TK2MSFTNGP12.phx.gbl... > I'm trying really hard to jump on the bandwagon and migrate from Outlook > Express to Outlook, but the more I try, the more frustrated I get. > > Anywa...

Reading .wks file
Greetings...according to the Excel "help" file, as well as the file extension listing, I *should* be able to read an *.wks file, but Excel insists that it cannot. I am pretty sure the file was created in Microsoft Works. Is there a converter somewhere that I can download/install? Cheers - S2 Excel can read Works 2.0, not later. You have to save them in Works as excel files or Works 2.0 or get a commercial converter. -- Regards, Peo Sjoblom "Skip Stocks" <anonymous@discussions.microsoft.com> wrote in message news:AFC110E0-641D-4D87-9464-B930CC41CF02@microsoft....

Import data from Access to Excel containing VB code
Hi! I am trying to import data from an Access database to an Excel spreadsheet. I have imported several queries from Access into Excel already. However the last piece of data that I am wanting to import into Excel has VB code in the query doing a calculation automatically. So when I go to Excel to import that piece of data, those queries that contain the VB code don't even show up as import-able. Is there a way to import these queries from access into my excel worksheet? I am using Access 2003 and running on an XP OS. Is it possible to do it in Excel 2007 if not available in Excel 2003? I...

Import txt file into excel with 281,344 rows
Hi, I've got a very large txt file that I need to import into excel. It has 288,344 rows. Is there a way I can do this? The fields on my txt file are separated by a pipe "|" Thanks in advance. If you're using xl2007, then that data will fit. Open the .txt file and choose delimited by | If you're using xl2003 and below, you could use your favorite text editor to make several smaller .txt files (65536 rows or smaller) and import each into separate worksheets. JulieM39 wrote: > > Hi, I've got a very large txt file that I need to impo...

error attaching file to email
Getting the error: File Upload Failure There was a problem while attempting to upload the requested file. Check the path and try again. The file is a pdf, about 74 KB. Any ideas?? ...

Compiled Excel macros
Hi, I think about selling my own Excel wordbook, that contains some macros. But I don't want anyone to see these macros. I tried to set password on VBA project, but it's insecure. There are programs to crack this password. I know, that Access has *.mde files, which contain macros in a compiled form. Does Excel have a similar functionality? Are there any other hints to prevent users from seeing the macros? Thanks in advance! T. You can create COM addins or DLLs that are written in VB and can be compiled, but not in VBA. Problem here of course is that you need a full version o...

Why do Excel and Access freeze on the splash page?
I have just installed Office Pro 2003, removing all previous versions, and I can load Word, but not Excel, Access or Powerpoint. I have tried running virus software (up to date McAfee), re-installing and re-booting but nothing is working. I had the same problem in Office 2000 as well with Excel. Help please. Thanks, Chris. ...

path of .pst file
Hello everyone, I want to develop a stand alone application to send and recieve mails through MS Outlook.how can i retrieve the path of .pst file from .net application. actually i am thinking of reading the pst file of MS Outlook. is it possible? Thanks in Advance jyoti The pst file is stored in the profile path of the MSOUTLOK Since the path of the pst can be varied by the user, as can its name, ie it neednt be in the install default path, your app would first have to search for the pst, then you would have to figure out if it/which was the current pst. There are alleged to be third ...

Weird files
Just noticed I've got a ton of weird files with names like 2BE48300. The normal files seem to be ok. Any idea what might be producing all these extra files? -- For a list of all the ways technology has failed to improve the quality of life, please press three. ....Alice Kahn Not sure. Perhaps cleaning up your hard drive will help. http://www.officearticles.com/misc/how_to_clean_up_your_hard_drive.htm Are they Excel files? **************************** Hope it helps! Anne Troy www.OfficeArticles.com **************************** "Steve" <teu@qprc.inv> wrote in message...

"File access denied" to PST file
I have gone from Windows 2000 running Outlook 2000 to Windows XP Pro running Outlook 2003. When I try opening my saved .pst file in the new Outlook I get a message saying "File access denied. You do not have permission required to access to file mailbox.pst" I am logged on as Administrator, as I was on the old install. How do I open my saved mailbox.pst or archive.pst? TIA How did you try opening it? is this a local .pst file? If it is not on your C: drive, is it marked Read-Only? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion int...

File won't open as read only
I have a file that is in use, but another person opens it and it doeasn't display the "file is in use" message. Is there a setting or fix? Hi have you shared this file? -- Regards Frank Kabel Frankfurt, Germany John wrote: > I have a file that is in use, but another person opens it > and it doeasn't display the "file is in use" message. Is > there a setting or fix? The file is on a network share. The share has all the appropriate permissions. >-----Original Message----- >Hi >have you shared this file? > >-- >Regards >Frank Ka...

Delete oldest file first
All, I am looking for some code that deletes the oldest files first in a directory. Any help would be great. Thanks in advance. "karibbean" <sharp_mind@REMOVE.this.email.msn.dotcom> wrote in message news:uJZArpxvFHA.2132@TK2MSFTNGP15.phx.gbl... > I am looking for some code that deletes the oldest files first in a > directory. Any help would be great. Thanks in advance. See FindFirstFile, FindNextFile, FindClose, DeleteFile -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is ...

How to give other users read-only access to Calendar
I want to allow the group Everyone to have read-only access to a calendar in a certain mailbox. I can do this by granting the permission 'Full mailbox access' (under 'Mailbox rights', under 'Exchange Advanced', for the particular user). However this also allows people to to do everything (ie: they become read-write users). I notice that every mailbox in the system has 'Read permissions' granted to group Everyone. This does not allow other people to open items in the mailbox, but as I understand it, permits Exchange Server and Outlook to do shared meetin...

Create Auto Text in Excel?
I want to be able to add the following function (=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename ",A1),1))) into any excel sheet that I'm working on like you can do in Word with Auto Text insert. I think I should be able to do this with a macro but I can't figure out how to do it. Any help much appreciated. Cheers Lee First, you can shorten the formula a bit and reduce the number of function calls by using =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,32) XL doesn&...

scrambled excel file
Hi AGAIN. I'm trying to open a file that was deleted and later retrieved through GetData Back. It has an .xls extension, but when I try to open it, it's just symbols. Is there some way I can retrieve the proper info. from that file? Do I have to save it as something else? I really need this file back - l mean life & death!! I will attach the file to see if someone can figure this out for me. Thanks again for your help. Your advice last time was great. Sandy Attachment filename: wolf_info liz.xls Download attachment: http://www.excelforum.com/attachment.ph...

Make excel 2003 default to open files
I have Excel 2003 running alongside 2007. Double clicking an excel file causes it to open in 2007; how do I force 2003 to open the files instead? Sandy You most likely have to reset your file association from 2007 to 2003. Close Excel first and On the Windows Taskbar 1) Start>Run "excel.exe /unregserver"(no quotes)>OK. 2) Start>Run "excel.exe /regserver"(no quotes)>OK. See the space between exe and /regserver You might have to designate a full path to excel.exe for Office 2003 In that case Start>Run "C:\your path to\office11\excel.exe" ...

Read mail arn't marked as read anymore
After an SP upgrade of my Office 2000 the priviewed mail doesnt get marked as read anymore. I have tried to change the time (Tools->Options->Priview pane) from 2 -> 3 -> 4 seconds but nothing works. The only way to mark a mail as read is either to open it or right click it and chose Mark as read. Since I only use the priview pane this is very anoying for me. Is this a bug or has some setting changed with the SP? ...

Several files opening at the same time
I have a shortcut on my Quick Launch bar to a file called Index.xls wherein other hyperlinks take me to a zillion other places as a means of organisation of my computer data. For a couple of months I've been finding that whenever I click Index.xls another file called PERSONAL.XLS opens as well (or in fact momentarily before). I don't know why this is happening. As far as I know I did not change anything that might cause this phenomenon. I located PERSONAL.XLS and changed the filename to PERSONAL.XL1 to see if that might prevent it from opening, but now I have PERSONAL.XL1, PERSONA...

open pst file?
I received an email on outlook and saved it to a file in my docs to review later. Now, I tried to open a pst file in the email and was given a message that there is no program available to open it, or something to that effect. I have gone to the office website--no info. I read the discussion postings here and the closest one seems to suggest a solution through explorer somehow. I am not versed in these issues. It would seem there would be a built-in solution for this but apparently not. I am stuck! You have to use your email client to import a PST file. Go to FILE>IMPORT AND E...

Can you use excel 2003 version with excel 2002 and 2000 on a netw.
We have 5 computers on a network and want to use different versions of excel and access. Will this work or do we need to have all of the same versions on each computer. All versions of Excel from XL97 have same file format. This is NOT so with Access, someone with an older version may have trouble opening a file make under a newer version. For details contact an Access newsgroup. best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "cct" <cct@discussions.microsoft.com> wrote in message news:A30C0517-AC63-4EE6-9E64-669E2F7D8389@microsof...

Accessing data from Excel spreadsheet
Hello World, Does anyone know if there is a relatively easy way to read fields in an Excel spreadsheet from VC++? Thanks, Stephanie You can always save the data in .csv form and read it in after parsing. Another more elegant approach would be to use automation and use excel's object model to access the data. Here is good starting point for automation: http://support.microsoft.com/kb/q178781/ --- Ajay Stephanie Doherty wrote: > Hello World, > > Does anyone know if there is a relatively easy way to read fields in an > Excel spreadsheet from VC++? > > Thanks, > S...

reading confirmation
Good day, I have a problem with outlook. When they send a message to me that demands the shipment of a reading confirmation, even if I accept, the reading confirmation does not come received from the sender. Someone knows from what depends and in which way I can resolve the problem? Thanks for the eventual answers. Niki In news:eht7fo$251$1@fata.cs.interbusiness.it, Niki <nicola.pantaleo@yahoo.it> typed: > Good day, > > I have a problem with outlook. When they send a message to me that > demands the shipment of a reading confirmation, even if I accept, the > read...

"Unblock" feature should be optional when reading e-mail in CRM
When viewing e-mail messages in CRM, a line appears saying "Unblock" to allow the full message content to be read. Can this be made a configurable server or security setting? We are trying to reduce "clicks" as much as possible. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agre...

keep formula after typing in a value in a excel cell
Hi there, my problem is, that i need something like: there is a function in a excel-cell (for example '=setvalue("sqlserver", "DB", "table")'). now i type in a value (for example 100) then the function "setvalue" must write this value (100) in the server, db and table from the parameters. after leaving the cell the formula is still the same and only the value 100 ist visible for the user. and if i go back to the cell than i can see the function in the menubar. there is a product from applix (TM1) and they did it. the problem is, that the souce...

Detect Excel minimize and restore?
I need to be able to detect the event when someone minimizes or restores the Excel application. How can I do this?? (if it's even possible) Thanks folks! Looks you can't detect the Excel main window resize, only the workbook window resize. I would think it is possible. Maybe with a VB6 ActiveX exe. You could ask in the classic VB (VB6) group: microsoft.public.vb.general.discussion RBS "Robert Crandal" <nobody@gmail.com> wrote in message news:KToTm.76787$W77.11624@newsfe11.iad... >I need to be able to detect the event when someone > mi...