Click here to Skip to main content
15,564,879 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi all i have an CSV format file that contains string "true" and "false" but that CSV file from Excel 2010 it automatically converts to Upper case.I need same as lowercase string.How to resolve the problem???

Thanks in Advance
Posted
Updated 11-Jun-22 4:44am
Comments
Andy Lanng 17-Dec-15 7:05am    
It sounds like they are taking the value "true", converting it to a bool (represented as "True" in vb) then adding that to the excel file?

How are you importing the csv? Can you add the string.ToLower() extension to the bool?
Maniraj.M 17-Dec-15 7:14am    
Not like that.Im creating 1 csv file from excel it contains string value of "true" but when close and open that file it showing like TRUE.I dont want to use any formulae.If i save string true with 1 space its working good but i want without space.As well as if i save 'true like this its working but after closing and opening again showing like TRUE
ZurdoDev 17-Dec-15 8:05am    
1. Reply to the comment so that the user is notified instead of adding a comment to your own question.
2. When you import into Excel specify that it is a text column.
3. Who cares if it is upper or lower case? Just wondering.

If you have text that you want to remain untransformed by Excel then you must save it in the CSV file surrounded by double-quotes e.g. if a file contains
TRUE,True,true,"True","true"
Then the last two columns are explicitly text columns.

If you set the columns to "Text" format then when you save the file it will still be saved as
TRUE,True,true,True,true
Note the lack of double-quote characters

Unfortunately if you double-click on the CSV or use File, Open, from within Excel the columns will revert to "General" format and the example above will display as
TRUE   TRUE   TRUE  TRUE   TRUE

In order to retain the formatting you need to Import the data into Excel.

Using the Text Import Wizard, choose comma as the delimiter and when you get to "Step 3 of 3" highlight the appropriate column and click the "Text" RadioButton. Now when you press "Finish" Excel will display
TRUE   TRUE   TRUE   True  true

One very important thing to note - in your original spreadsheet TRUE has a value of, well, TRUE...in the either True or False sense. But in your CSV you are forcing the column to be a text value. You can demonstrate this by using the following formula (in Excel) to report on the values (dragging it across from Column A to Column E
=IF(A1=TRUE, "yep", "nope")
You should note that for Columns D and E "nope" is the result. Before you insist on "true" staying as lowercase, consider the impact this will have on any other areas of the worksheet... this is what RyanDev was pointing out to in their point 3.
 
Share this answer
 
Comments
Maniraj.M 22-Dec-15 2:26am    
Thank u
Hi maybe this help you:
=lower(text)
=lower(true)
 
Share this answer
 
v2
Comments
CHill60 30-Jun-22 9:13am    
Where is the OP meant to put that formula in a CSV (which does not support formulas)? See the full explanation of what is happening, why it is happening and how to avoid it, in Solution 1
behruz12 5-Jul-22 3:20am    
In Excel CSV file you can in one empty cell put =lower(true) and copy it then select all cells with true via Ctrl+F & Ctrl+A and paste as values in a simple way.
Macro for formula and copy:
Sub copy()
'empty cell d4 place =lower(true)
[d4]="=Lower(true)"
[d4].copy
End sub

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900