Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Display leading zeros in numeric value without converting to text | Excel Discussion (Misc queries) | |||
removing leading zeros in numeric fields | Excel Discussion (Misc queries) | |||
remove leading zeros from text strings | Excel Worksheet Functions | |||
save text field w/ leading zeros in .csv format & not lose zeros? | Excel Discussion (Misc queries) | |||
Leading Zeros in Numeric Values | Excel Worksheet Functions |