Share via

Text formatting is lost when saving a file as a CSV

Anonymous
2024-02-20T17:10:38+00:00

Spreadsheet is formatted to text and once the file is saved the formatting changes to general. The spreadsheet is saved as a CSV file.

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2024-02-20T17:22:51+00:00

    When saving a file as a CSV, Excel will remove any formatting from the cells and save only the values. This is because CSV files are plain text files and do not support formatting.

    4 people found this answer helpful.
    0 comments No comments
  2. Rich~M 20,370 Reputation points Volunteer Moderator
    2024-02-20T23:22:19+00:00

    Hi David. I am an Excel user like you.

    Since the .CSV file contains no formatting when it is re-opened in Excel it is opened each time as a new file and Excel evaluates the content of the columns to apply the most obvious formatting. Most of the columns will probably say they are formatted as General. This is not a problem unless the data is being imported incorrectly. The .CSV file will still be only text when the file is saved again and can be opened as a text file using Notebook or a similar text application.

    If the data is being imported incorrectly when opening the file, you can go through the import process to identify how the data should be imported. Here is the process to follow.

    Note: When I did this experimenting with a column of dates and changed them to text after I imported them the column formatting still said General, however, the data was in fact saved as text. You can verify this by trying to change the format of one of the cells. If it is saved as a number, you can change it, for example, from date to currency and back. If it is saved as text, it will not change.

    If you are having difficulty formatting the data/Columns from a .csv file before bringing it into your Excel spreadsheet, you can use Get Data to do this. Open a new Excel file. On the Data Ribbon go to Get Data>From File>From Text/CSV.

    Image

    .

    Find and select the file you are looking for and click Import at the bottom of the window.

    In the window that comes up click on Transform Data at the bottom of the window.

    Image

    .

    This will open the Power Query Editor. Check your columns and for any that need the format to be corrected. Click on the column Header and in the Home Ribbon>Transform section click the dropdown for Data Type and select the correct data type for your column.

    Image

    .

    When all columns are correctly formatted, click on Close and Load at the left end of the Home Ribbon.

    Image

    .

    This will load the file into a sheet in your workbook. The Query will be kept as part of the file at this point. If desired, you can delete the query by going to the Query Ribbon and clicking Delete in the Edit section.

    Image

    .

    2 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2024-10-17T19:56:56+00:00

    I am trying to do this for a file used with Ebay upload. I do all your steps. That part works. However when I go to save it as a CSV file it fails to upload. So when I go to open it is has changed the item number back to a number like so

    2.54E+11<br><br>I need it to stay as a whole number for the file to upload correctly.

    Hi David. I am an Excel user like you.

    Since the .CSV file contains no formatting when it is re-opened in Excel it is opened each time as a new file and Excel evaluates the content of the columns to apply the most obvious formatting. Most of the columns will probably say they are formatted as General. This is not a problem unless the data is being imported incorrectly. The .CSV file will still be only text when the file is saved again and can be opened as a text file using Notebook or a similar text application.

    If the data is being imported incorrectly when opening the file, you can go through the import process to identify how the data should be imported. Here is the process to follow.

    Note: When I did this experimenting with a column of dates and changed them to text after I imported them the column formatting still said General, however, the data was in fact saved as text. You can verify this by trying to change the format of one of the cells. If it is saved as a number, you can change it, for example, from date to currency and back. If it is saved as text, it will not change.

    If you are having difficulty formatting the data/Columns from a .csv file before bringing it into your Excel spreadsheet, you can use Get Data to do this. Open a new Excel file. On the Data Ribbon go to Get Data>From File>From Text/CSV.

    Image

    .

    Find and select the file you are looking for and click Import at the bottom of the window.

    In the window that comes up click on Transform Data at the bottom of the window.

    Image

    .

    This will open the Power Query Editor. Check your columns and for any that need the format to be corrected. Click on the column Header and in the Home Ribbon>Transform section click the dropdown for Data Type and select the correct data type for your column.

    Image

    .

    When all columns are correctly formatted, click on Close and Load at the left end of the Home Ribbon.

    Image

    .

    This will load the file into a sheet in your workbook. The Query will be kept as part of the file at this point. If desired, you can delete the query by going to the Query Ribbon and clicking Delete in the Edit section.

    Image

    .

    0 comments No comments
  4. Anonymous
    2024-02-21T07:11:25+00:00

    You should use xlsx to store formatting on Excel file.

    0 comments No comments
  5. Anonymous
    2024-02-20T19:59:09+00:00

    Thank you for your reply. The formatting we desire is TEXT format. We understand CSV files are standard text files and are not trying to have any other formatting, just text.

    0 comments No comments