ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CSV formatted text file to Excel (https://www.excelbanter.com/excel-programming/290641-csv-formatted-text-file-excel.html)

Sobhan

CSV formatted text file to Excel
 
Hi all,
I am writing a small VC++ application of how to import the CSV
formatted
..txt file to excel. I am facing problem while parsing the text file.

"TicketNo","CarNo","PersonAge"
12534 , 763534 , 23
12345 , 624333, 24

The problem is in MFC there is a SetValue2(CoeVariant:column data)
method in which if i will pass an array(12534) then it will be
imported to excel.For example IfI will search for the "employee
number" field in text file then the values passed to SetValue2()should
be 12543 and 12345.But Using C++ I cannot do so as I have to read the
values rowwise(record by record) from the text file.I tried to return
a vector(to return integer values-12345).But I got 80 errors as
probably VC++ -6.0 is not compatible to the same.
1.My Main problem is how to extract values for "TicketNo"--12534 and
12345 from the text file to my application.
2.How to skip the header after reading the same?
3.Do I have to use some other method of MFC? Does anybody know there
exists a
AfxExtractSubstring() function in MFC.As I tried to search in MSDN but
couldnot got it?
Do anybody have sample source code for the particular application then
it may prove helpful for me?

Bubunia

Tom Ogilvy

CSV formatted text file to Excel
 
Excel will do what you want just by opening the file in excel. Then you can
just access the first column.

Not sure why you want to preprocess it VC++

in Excel, do file=Open, select the CSV file and click OK.

You will see it parsed into separate columns in Excel.

--
Regards,
Tom Ogilvy


Sobhan wrote in message
om...
Hi all,
I am writing a small VC++ application of how to import the CSV
formatted
.txt file to excel. I am facing problem while parsing the text file.

"TicketNo","CarNo","PersonAge"
12534 , 763534 , 23
12345 , 624333, 24

The problem is in MFC there is a SetValue2(CoeVariant:column data)
method in which if i will pass an array(12534) then it will be
imported to excel.For example IfI will search for the "employee
number" field in text file then the values passed to SetValue2()should
be 12543 and 12345.But Using C++ I cannot do so as I have to read the
values rowwise(record by record) from the text file.I tried to return
a vector(to return integer values-12345).But I got 80 errors as
probably VC++ -6.0 is not compatible to the same.
1.My Main problem is how to extract values for "TicketNo"--12534 and
12345 from the text file to my application.
2.How to skip the header after reading the same?
3.Do I have to use some other method of MFC? Does anybody know there
exists a
AfxExtractSubstring() function in MFC.As I tried to search in MSDN but
couldnot got it?
Do anybody have sample source code for the particular application then
it may prove helpful for me?

Bubunia




Sobhan

CSV formatted text file to Excel
 
Reason is that I want to write an automated application without doung
it manually.Could you help?

"Tom Ogilvy" wrote in message ...
Excel will do what you want just by opening the file in excel. Then you can
just access the first column.

Not sure why you want to preprocess it VC++

in Excel, do file=Open, select the CSV file and click OK.

You will see it parsed into separate columns in Excel.

--
Regards,
Tom Ogilvy


Sobhan wrote in message
om...
Hi all,
I am writing a small VC++ application of how to import the CSV
formatted
.txt file to excel. I am facing problem while parsing the text file.

"TicketNo","CarNo","PersonAge"
12534 , 763534 , 23
12345 , 624333, 24

The problem is in MFC there is a SetValue2(CoeVariant:column data)
method in which if i will pass an array(12534) then it will be
imported to excel.For example IfI will search for the "employee
number" field in text file then the values passed to SetValue2()should
be 12543 and 12345.But Using C++ I cannot do so as I have to read the
values rowwise(record by record) from the text file.I tried to return
a vector(to return integer values-12345).But I got 80 errors as
probably VC++ -6.0 is not compatible to the same.
1.My Main problem is how to extract values for "TicketNo"--12534 and
12345 from the text file to my application.
2.How to skip the header after reading the same?
3.Do I have to use some other method of MFC? Does anybody know there
exists a
AfxExtractSubstring() function in MFC.As I tried to search in MSDN but
couldnot got it?
Do anybody have sample source code for the particular application then
it may prove helpful for me?

Bubunia


Tom Ogilvy

CSV formatted text file to Excel
 
Turn on the macro recorder (tools=Macro=Record a New Macro) and do it
manually in excel. That will give you the objects you need to use. I
don't know C++, so beyond that you will have to figure out how to call them.

--
Regards,
Tom Ogilvy


Sobhan wrote in message
m...
Reason is that I want to write an automated application without doung
it manually.Could you help?

"Tom Ogilvy" wrote in message

...
Excel will do what you want just by opening the file in excel. Then you

can
just access the first column.

Not sure why you want to preprocess it VC++

in Excel, do file=Open, select the CSV file and click OK.

You will see it parsed into separate columns in Excel.

--
Regards,
Tom Ogilvy


Sobhan wrote in message
om...
Hi all,
I am writing a small VC++ application of how to import the CSV
formatted
.txt file to excel. I am facing problem while parsing the text file.

"TicketNo","CarNo","PersonAge"
12534 , 763534 , 23
12345 , 624333, 24

The problem is in MFC there is a SetValue2(CoeVariant:column data)
method in which if i will pass an array(12534) then it will be
imported to excel.For example IfI will search for the "employee
number" field in text file then the values passed to SetValue2()should
be 12543 and 12345.But Using C++ I cannot do so as I have to read the
values rowwise(record by record) from the text file.I tried to return
a vector(to return integer values-12345).But I got 80 errors as
probably VC++ -6.0 is not compatible to the same.
1.My Main problem is how to extract values for "TicketNo"--12534 and
12345 from the text file to my application.
2.How to skip the header after reading the same?
3.Do I have to use some other method of MFC? Does anybody know there
exists a
AfxExtractSubstring() function in MFC.As I tried to search in MSDN but
couldnot got it?
Do anybody have sample source code for the particular application then
it may prove helpful for me?

Bubunia





All times are GMT +1. The time now is 06:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com