ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   import csv file (https://www.excelbanter.com/excel-discussion-misc-queries/672-import-csv-file.html)

Patrick

import csv file
 
How can I get excel to import a csv file with entries like "000111" and
format it as text



My database creates a csv file to load into excel

It contains a name and a id field
eg
"joe bloggs","jb01"

this loads into excel no problem both columns formatted as text as needed

unfortunately some of the ids begin with zero and only contain numbers
when loaded into excel they are convereted to numbers and leading zeros
chopped off. I need them to stay as text

I can make excel display leading zeros - but its still a formatted as a
number - no good!
Using a ' on the front loads in correctly but as soon as the ' is removed it
reverts to a number

Thanks

--
Patrick

Nick Hodge

Patrick

Excel sees a file with an extension of *.csv as native and so opens it
without any user intervention. This can be both an advantage and a
disadvantage. You have the latter.

To overcome, rename your file with no extension and in Excel go to
Open...'Files of type' 'All and navigate to your file. This will invoke
the text import wizard. Use delimited and then comma and in the third step,
highlight the columns you want as text and mark them as so. Excel will
import these as so with leading zeroes, etc.

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Patrick" wrote in message
...
How can I get excel to import a csv file with entries like "000111" and
format it as text



My database creates a csv file to load into excel

It contains a name and a id field
eg
"joe bloggs","jb01"

this loads into excel no problem both columns formatted as text as needed

unfortunately some of the ids begin with zero and only contain numbers
when loaded into excel they are convereted to numbers and leading zeros
chopped off. I need them to stay as text

I can make excel display leading zeros - but its still a formatted as a
number - no good!
Using a ' on the front loads in correctly but as soon as the ' is removed
it
reverts to a number

Thanks

--
Patrick




Patrick

Thank you

Of course it works perfectly

Been tryiong to do it for ages

Thanks

Patrick

"Nick Hodge" wrote:

Patrick

Excel sees a file with an extension of *.csv as native and so opens it
without any user intervention. This can be both an advantage and a
disadvantage. You have the latter.

To overcome, rename your file with no extension and in Excel go to
Open...'Files of type' 'All and navigate to your file. This will invoke
the text import wizard. Use delimited and then comma and in the third step,
highlight the columns you want as text and mark them as so. Excel will
import these as so with leading zeroes, etc.

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Patrick" wrote in message
...
How can I get excel to import a csv file with entries like "000111" and
format it as text



My database creates a csv file to load into excel

It contains a name and a id field
eg
"joe bloggs","jb01"

this loads into excel no problem both columns formatted as text as needed

unfortunately some of the ids begin with zero and only contain numbers
when loaded into excel they are convereted to numbers and leading zeros
chopped off. I need them to stay as text

I can make excel display leading zeros - but its still a formatted as a
number - no good!
Using a ' on the front loads in correctly but as soon as the ' is removed
it
reverts to a number

Thanks

--
Patrick






All times are GMT +1. The time now is 10:14 AM.

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