ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Importing text columns in csv file (https://www.excelbanter.com/excel-programming/287621-importing-text-columns-csv-file.html)

Kelvin Smith

Importing text columns in csv file
 
Is there any way to force Excel to treat a column of data
in a .csv file as text, rather than as "general"? I have a
column of numbers for which I need to keep the leading
zeroes (zip codes), and standard behavior opening a .csv
file treats the value as a number and strips the zeroes.
I'm using a macro, but using FieldInfo:=Array(Array(1, 2))
as a qualifier on Workbooks.OpenText doesn't seem to have
any effect on a .csv file, though it works fine for a .prn
or .txt file.

Is my only choice to rename the file? I guess I can do
that inside the macro, but it seems a very inconvenient
way to get a very basic operation done.

pikus

Importing text columns in csv file
 
Before the data is moved you should format the cells as text:
Main Menu Format--Cells--"Number" Tab Select "Text"

You may need to paste using a right click and "Paste Special"/"Values"

-Piku

--
Message posted from http://www.ExcelForum.com


No Name

Importing text columns in csv file
 
Sorry, this doesn't help. I'm not copying and pasting; I'm
pulling the information in from a .csv text file.

Kelvin Smith

-----Original Message-----
Before the data is moved you should format the cells as

text:
Main Menu Format--Cells--"Number" Tab Select "Text"

You may need to paste using a right click and "Paste

Special"/"Values"

-Pikus


---
Message posted from http://www.ExcelForum.com/


pikus

Importing text columns in csv file
 
Pulling how?


---
Message posted from http://www.ExcelForum.com/



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

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