Interacting With Excel Using.... ?

note:*I recently finished learning the basics of using C++, which included reading the tutorials from this site as well as several video tutorials*

So what i want to do is create a program that interacts with excel.

What I need it for:

I get excel spreadsheets to update product pricing sheets on my companies websites. So the process can be really tedious.

I need the program to Copy and Paste from certain fields in excel and navigate threw a website, and run queries threw the search box on the site. match the contents of the clipboard and the results from the search and lastly change the price.

Kinda Funny I just went threw the basics of C++ but I still cant really do anything...I hoping for this to be a productive first project. I plan on using Visual C++ 2008 Express, with the SDK (will this work ?)

What the best way to about doing this ? Can anyone provide me with some reference material ? Or the names of some Useful functions.

Where to start!? Thanks in Advance!
Last edited on
Wow. Your going to have alot of fun with this project.

Where to start eh.

1) Interfacing to Excel.
This can be done a few different ways. If you are able to have the excel converted into a standard format like CSV then it's going to help you alot. Otherwise you will need to have a COM object or library that allows you to read/write excel files. Google may turn up some useful libraries.

2) Navigate through a website.
You will need to use an HTTP class to send/receive HTTP requests in the same way a browser does. So a good start would be learning how to do C++ TCP Sockets and how the HTTP protocol works. Google again can provide some help on the protocol information.

3) Match the contents.
This will be easy once you parse your excel file and the response from your HTTP request. I don't see you needing to use the clipboard here though.


Now, all that aside. I think you are trying to solve this problem in your head incorrectly. "Copy and Paste" are not things you would be doing unless you are using a screen capture program and/or writing macros to accomplish task. Using a Macro application (something like WinRunner which automates GUI Tasks) maybe more suited to your task.

As far as a first project. I would rate this task as Intermediate level, definitely not beginner. Sorry.

Z.
Yeah Z. is right IMHO.

Work with the CSV format, first line should be the header with field descriptions of the underlying fields. Hope you're good with arrays, since it seems to be a natural for this.

2 and 3 should be easy.

y.
You don't have to work with arrays. You could load each line into a Vector as it's required and then iterate through the vector. It'd be a lil bit messier code, but it'd be easier to avoid a memory leak of buffer overflow etc :)

e.g.
1
2
for each field in line
 vFieldList.push_back(field)
Thanks for the input Z,

I'll look into changing it into csv, tcp sockets, and http requests and try to get familiar.

For some reason in my head i thought this was gonna be alot simplier than it sounds now.

As far as a first project. I would rate this task as Intermediate level, definitely not beginner. Sorry.


maybe i should consider working with something simpler first ? and come back to this later.
I would recommend that yes. Is this project for work or personal? If it's for personal then I'd definitely leave it, or develop it in smaller pieces so you can be familiar with the problem better.

e.g Develop a basic TCP/IP Client/Server that sends a message to each other. This would give you a good understanding of how to do network connections in C++... etc...
Well its a personal project for something work related, so its not like i have a deadline, i just thought i would be something useful to have. And also very good exp.

But yea i think I gonna do a basic tcp client server message send/receive.

like you suggested.

No worries man :) Good luck.
My new post is more or less a extension or a reworking of this idea. So i thought it would be nice to update this post.

Please Go To: http://www.cplusplus.com/forum/windows/2376/

Thanks
Last edited on
Topic archived. No new replies allowed.