writing out data to excel

Jul 2, 2015 at 2:07pm
Hi,
i have written a C++code and i have 9 output txt files. However, i need these outputs in one excel with 9 workspaces. Is there a easy way to do that? Also, how can i put what i want to each cell of excel workspace?
Jul 2, 2015 at 6:35pm
Yes, M$ Excel has a C\C++ API however the learning curve is prohibitively steep. Unless you plan on writing an entire add-on package then I would suggest that you take a different route. Since you require these documents to be collated in an Excel document, I would recommend any number of scripting languages such as powershell, VBS\VBA, python etc. Even if you don't know any of these right now, you could easily gain an advanced understanding of any one of them I've listed in roughly half the time it would take you to garner a functional understanding of the Excel object in C\C++. If you really require a finer grain of control then what a scripting language offers then I understand that C# is a not so painful solution, although I don't have any personal experience with it.
Jul 2, 2015 at 8:26pm
@
do you need it to communicate or do you just want them to be in there?
If you just want to dump them there you could split your columns with tabs, your rows with newlines and just copy everything... :')

If not, good luck with it, others may be able to help you better.

Jul 2, 2015 at 8:34pm
This thread shows code doing basic operations on Excel using the COM-based Automation API. If you aren't familiar with COM then you will have a steep learning curve!!

Need to select a cell or range in excel, from C++ code
http://www.cplusplus.com/forum/windows/164379/

Andy
Last edited on Jul 3, 2015 at 2:04pm
Jul 3, 2015 at 5:18am
Thanks for help,
Hopefully, i won't read any data from excel, i have used two text files for reading and i will only write them out to excel but i will need 9 pages of excell in one excel document. How do i do this and
@Gamer2015 i have done what you sugggested but they are still in one column with tab seperated :/
Jul 3, 2015 at 6:26am
@ataik:
In the registers at the top go to "Data", then there should be "Text in Columns" somewhere...

https://support.office.com/en-GB/Article/Split-text-into-different-cells-30b14928-5550-41f5-97ca-7a3e9c363ed7

You may omit step 7 & 8 if you want to seperate them in-place
Last edited on Jul 3, 2015 at 6:47am
Jul 3, 2015 at 8:20am
Thank you, that is solved now, only thing i need is tohave 9 pages of outputs in nine pages of 1 excel. Is there any way to do this without library or i can have your suggestions,
Jul 3, 2015 at 8:48am
Do you make it by hand or automatically now?
Jul 3, 2015 at 10:06am
I need program to place them automatically. :/
Jul 3, 2015 at 10:14am
Sry, can't help you with that, but good luck!
Jul 5, 2015 at 3:41am
Topic archived. No new replies allowed.