Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default CSV and Numeric Strings with Leading Zeros

I am trying to deliver a report in CSV format, which admittedly is not my
favorite text format. There is a field that is a numeric string,
occasionally having leading zeros, which is causing an issue.

I am getting my data out of a SQL Server query (not that it matters a lot)
and I initially tried to enclose allt he text fields in double quotes.
Opening the CSV in Excel resulted in the double quotes not being visible, but
the numeric string field still suffered from the dropped leading zeros.

I then tried to add a single quote in that field, first after the double
quote (now the whole numeric string is displayed with the leading zeros, but
ALSO with the single quote), then with the single quote before the double
quotes (now the string appears enclosed in the double quotes when opened in
Excel)...tried just a single single quote before the field, and still no dice.

I tried to copy the data from SQL Server and paste in an Excel sheet with
the column formatted to test, then saving as a CSV. Same problem - open the
CSV and the leading zeros from this field are stripped.

Any insight ont his would be appreciated. Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 66
Default CSV and Numeric Strings with Leading Zeros

Ed Ardzinski wrote:
I am trying to deliver a report in CSV format, which admittedly is not my
favorite text format. There is a field that is a numeric string,
occasionally having leading zeros, which is causing an issue.

I am getting my data out of a SQL Server query (not that it matters a lot)
and I initially tried to enclose allt he text fields in double quotes.
Opening the CSV in Excel resulted in the double quotes not being visible, but
the numeric string field still suffered from the dropped leading zeros.

I then tried to add a single quote in that field, first after the double
quote (now the whole numeric string is displayed with the leading zeros, but
ALSO with the single quote), then with the single quote before the double
quotes (now the string appears enclosed in the double quotes when opened in
Excel)...tried just a single single quote before the field, and still no dice.

I tried to copy the data from SQL Server and paste in an Excel sheet with
the column formatted to test, then saving as a CSV. Same problem - open the
CSV and the leading zeros from this field are stripped.

Any insight ont his would be appreciated. Thanks!



Ed,

You can rename a .CSV to .TXT and import that. It will give you the
option of formating those numbers as text, preserving the leading zeroes.

Beege
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default CSV and Numeric Strings with Leading Zeros

Ed,

You can rename a .CSV to .TXT and import that. It will give you the
option of formating those numbers as text, preserving the leading zeroes.

Beege


I could do that, but the file is supposed to be sent to someone else to load
into a batch process. I'm not sure the recipient would be happy to have an
extra step in their process.
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
Display leading zeros in numeric value without converting to text Gmonny Excel Discussion (Misc queries) 4 October 5th 06 09:05 PM
removing leading zeros in numeric fields dingy101 Excel Discussion (Misc queries) 3 November 21st 05 03:46 AM
remove leading zeros from text strings snooze Excel Worksheet Functions 2 July 26th 05 05:59 PM
save text field w/ leading zeros in .csv format & not lose zeros? Ques Excel Discussion (Misc queries) 1 May 4th 05 06:21 PM
Leading Zeros in Numeric Values DBavirsha Excel Worksheet Functions 6 January 4th 05 05:21 PM


All times are GMT +1. The time now is 11:20 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"