Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Text fields with numbers in .csv file

Hi,

I'm programming an application that exports table data to a file with
extension csv with columns separated by seicolumns (or xls separated by tab).

The problem is that I have a field that holds a SSCC number (18 digit
number) that is handled as a text field.

When I open then file in Excel that field is converted to a cientific number
like 3,56E+17. And is not all, in fact the number stored in cell is
356000000200000000 when then number that is in original file (if I open it
with notepad) is 356000000200000013! It is rounding the number!

I tried to add an apostrophe before the number but it didn't solved te
problem too because it shows up in the field as part of the value, and that
create me problems when I have to compare ou print values.

Does any one knows a solution for this problem? Is there a char that I can
add before the field that Excel interprets as a text field but know that that
first char does not belong to the field value?

Thanks,
Pedro Gonçalves

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Text fields with numbers in .csv file

Pedro,
If you record a macro whilst you DataGet External DataImport Text File,
you get the chance to specify the data type of the columns.

NickHK

"Pedro Gonçalves" wrote in message
...
Hi,

I'm programming an application that exports table data to a file with
extension csv with columns separated by seicolumns (or xls separated by

tab).

The problem is that I have a field that holds a SSCC number (18 digit
number) that is handled as a text field.

When I open then file in Excel that field is converted to a cientific

number
like 3,56E+17. And is not all, in fact the number stored in cell is
356000000200000000 when then number that is in original file (if I open it
with notepad) is 356000000200000013! It is rounding the number!

I tried to add an apostrophe before the number but it didn't solved te
problem too because it shows up in the field as part of the value, and

that
create me problems when I have to compare ou print values.

Does any one knows a solution for this problem? Is there a char that I can
add before the field that Excel interprets as a text field but know that

that
first char does not belong to the field value?

Thanks,
Pedro Gonçalves



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Text fields with numbers in .csv file

Hi Nick,

I don't see where I can define the type of each column.

I can define a all column formatted as text, but when I get data from
external it gets it already in cientific format, and with the numbers rounded.

If I add the apostrophe before the data field the field shows up as text but
with the ' visible. To convert the field I have to edit all of them one by
one. Just need to edit and Enter.

Regards,
Pedro Gonçalves


"NickHK" wrote:

Pedro,
If you record a macro whilst you DataGet External DataImport Text File,
you get the chance to specify the data type of the columns.

NickHK

"Pedro Gonçalves" wrote in message
...
Hi,

I'm programming an application that exports table data to a file with
extension csv with columns separated by seicolumns (or xls separated by

tab).

The problem is that I have a field that holds a SSCC number (18 digit
number) that is handled as a text field.

When I open then file in Excel that field is converted to a cientific

number
like 3,56E+17. And is not all, in fact the number stored in cell is
356000000200000000 when then number that is in original file (if I open it
with notepad) is 356000000200000013! It is rounding the number!

I tried to add an apostrophe before the number but it didn't solved te
problem too because it shows up in the field as part of the value, and

that
create me problems when I have to compare ou print values.

Does any one knows a solution for this problem? Is there a char that I can
add before the field that Excel interprets as a text field but know that

that
first char does not belong to the field value?

Thanks,
Pedro Gonçalves




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Text fields with numbers in .csv file

Pedro,
In the wizard, when you see the list of columns, select the SSCC header. Now
change the datatype from General to Text.

NickHK

"Pedro Gonçalves" wrote in message
...
Hi Nick,

I don't see where I can define the type of each column.

I can define a all column formatted as text, but when I get data from
external it gets it already in cientific format, and with the numbers

rounded.

If I add the apostrophe before the data field the field shows up as text

but
with the ' visible. To convert the field I have to edit all of them one by
one. Just need to edit and Enter.

Regards,
Pedro Gonçalves


"NickHK" wrote:

Pedro,
If you record a macro whilst you DataGet External DataImport Text

File,
you get the chance to specify the data type of the columns.

NickHK

"Pedro Gonçalves" wrote in

message
...
Hi,

I'm programming an application that exports table data to a file with
extension csv with columns separated by seicolumns (or xls separated

by
tab).

The problem is that I have a field that holds a SSCC number (18 digit
number) that is handled as a text field.

When I open then file in Excel that field is converted to a cientific

number
like 3,56E+17. And is not all, in fact the number stored in cell is
356000000200000000 when then number that is in original file (if I

open it
with notepad) is 356000000200000013! It is rounding the number!

I tried to add an apostrophe before the number but it didn't solved te
problem too because it shows up in the field as part of the value, and

that
create me problems when I have to compare ou print values.

Does any one knows a solution for this problem? Is there a char that I

can
add before the field that Excel interprets as a text field but know

that
that
first char does not belong to the field value?

Thanks,
Pedro Gonçalves






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import a txt file with text fields that have meaningful leading sp Muehe Excel Discussion (Misc queries) 2 April 3rd 08 11:48 PM
load a CSV file and have it take all fields as text cj Excel Discussion (Misc queries) 5 March 29th 07 02:24 PM
adding cells after stripping numbers out of text fields Alan Excel Discussion (Misc queries) 1 August 24th 05 08:22 PM
Text file import using ADO - XL converts fields to dates quartz[_2_] Excel Programming 1 July 22nd 05 03:43 PM
automatically open .txt file with all fields as text? Jerry Excel Discussion (Misc queries) 2 June 28th 05 04:35 PM


All times are GMT +1. The time now is 04:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"