I have an exported CSV file that needs to be reimported.
It has an address column having data like -
01-03, 08-01, 01-05
Upon opening the file in excel, it reads these values like dates.
I changed the column format to text after extracting the values into text as =TEXT(column,"dd-mm") and pasting the values, which shows the correct value 01-05.
However, when I close and re-open the file they are converted back to Dates again as 16-Mar, 01-May etc.
Related
I have a CSV file which has time column and its values are String in dd MMM HH:mm format.
Name,Time
Farms,20 Dec 14:00
When I open the CSV file with Excel, Excel automatically converts these Timevalues to date format, thereby modifying to add year value on its own. So 20 Dec 14:00 is converted to 20/12/22 14:00.
What I want is that Excel should display the time column values as raw string, i,e. 20 Dec 14:00.
Some similar questions, suggetsed to modify the CSV file by adding = symbol before the time column values, so that excel treat it as string. But this is not what I want.
I don't want to make any changes to CSV file, but want a way by making some changes in Excel itself.
Instead of opening the .CSV file by directly double-clicking, or dragging it onto an EXCEL instance, try using File->Open method, and use the text import Wizard, choose the comma delimiter, and when when it asks for the type of the column, choose text (you can choose multiple columns and choose text).
Alternatively, create a new empty worksheet, format the first column as text, open the file in a good text editor (like Notepad++), copy whole text (Ctrl-A, Ctrl-C), Alt-tab to EXCEL, place the cursor in A1, and paste (Ctrl-V). Now you can use the Data->Text to Columns wizard, and again you can choose text as type.
It can also be done in VBA, but performing the above steps are acceptable then why.
I am trying to save an excel file as a .csv file.
A 'Number' formatted column is automatically saved as 'General' column in the .csv file.
I am using Microsoft 2010 version. Is there any way to save all formatting while saving the .csv file from an excel file
This statement is wrong:
A 'Number' formatted column is automatically saved as 'General' column in the .csv file.
Let me explain you, using an example:
In an Excel sheet, I make three columns, called "Name", "Number" and "Date" and fill in the following values:
Name : My_Name
Number : 12345
Date : 5/05/2021
I save this as CSV file, and this is what I get (the entire file):
Name;Number;Date
My_Name;12345;5/05/2021
As you see, no formatting is mentioned, just the data itself.
So, CSV is not automatically saved as "General". But when you open a CSV file in an Excel instance, that Excel instance, not knowing anything about the formatting, just automatically applies "General".
I have an Excel file with some long ID values in Text format (e.g. 8888877777569564931). When I save the Excel file as CSV, those values are truncated: the last 4 digits are replaced with 0 (e.g. 8888877777569560000).
Is there a way to prevent this?
Thanks!
I've got a macro that imports data from a SQL db to excel then saves the results as a CSV file. When it saves to CSV the formatting of two of the columns is lost, resulting in the numbers not displaying correctly.
Column 1 contains 12 digit numbers such as '800000000000' which are showing in the CSV file as '8E+11'
Column 2 contains 10 digit numbers such as '4880000000' which are showing in the CSV file as '4.88E+09'
The data displays fine when it is first imported to excel, the problem occurs when saving to CSV, although when I expand column 2 in the CSV file it displays the full number. This doesn't work for column 1 though, I have to change the formatting of the cell.
I usually run the macro then send the created CSV file on to a colleague, is there a way I can keep the number formatting without having to open and edit the CSV file?
Thanks
Adding "=" before the quotes preserves the pattern
For Example if your csv file is like
A1,col1,col2,col3,="001"
The 5th column will still be 001 when opened in excel
I have an excel file with some numbers followed by a dot, say:
12345.
I created a simple macro to convert and save the excel file into a .csv file.
The problem is the CSV file does not save the dot. The data comes out as 12345 and not 12345. I also tried manually adding the dot and saving the csv file, but the dot just dissappears.
Anyway to add the dot into the CSV file?
http://i.stack.imgur.com/UoboK.jpg
Add a single quote/apostrophe in front of the number (without a closing quote at the end), so that it reads it as text and does not auto-format it as number.
For example you have:
12345.
Excel will auto-format that column as a number and drop the period unless you specify that it's a text only column.
Change it to:
'12345.
Excel will read that value as a text column and will not save the apostrophe in a text-based CSV file.
Edit:
In testing this, I found that ff you save it as "12345.", Excel changes the CSV file to """12345.""".