Stop Excel from automatically converting certain text values to dates

前端 未结 30 2601
别跟我提以往
别跟我提以往 2020-11-22 04:16

Does anyone happen to know if there is a token I can add to my csv for a certain field so Excel doesn\'t try to convert it to a date?

I\'m trying to write a .csv fil

相关标签:
30条回答
  • 2020-11-22 04:49

    Its not the Excel. Windows does recognize the formula, the data as a date and autocorrects. You have to change the Windows settings.

    "Control Panel" (-> "Switch to Classic View") -> "Regional and Language Options" -> tab "Regional Options" -> "Customize..." -> tab "Numbers" -> And then change the symbols according to what you want.

    http://www.pcreview.co.uk/forums/enable-disable-auto-convert-number-date-t3791902.html

    It will work on your computer, if these settings are not changed for example on your customers' computer they will see dates instead of data.

    0 讨论(0)
  • 2020-11-22 04:50

    While creating the string to be written to my CSV file in C# I had to format it this way:

    "=\"" + myVariable + "\""
    
    0 讨论(0)
  • 2020-11-22 04:50

    Still an issue in Microsoft Office 2016 release, rather disturbing for those of us working with gene names such as MARC1, MARCH1, SEPT1 etc. The solution I've found to be the most practical after generating a ".csv" file in R, that will then be opened/shared with Excel users:

    1. Open the CSV file as text (notepad)
    2. Copy it (ctrl+a, ctrl+c).
    3. Paste it in a new excel sheet -it will all paste in one column as long text strings.
    4. Choose/select this column.
    5. Go to Data- "Text to columns...", on the window opened choose "delimited" (next). Check that "comma" is marked (marking it will already show the separation of the data to columns below) (next), in this window you can choose the column you want and mark it as text (instead of general) (Finish).

    HTH

    0 讨论(0)
  • 2020-11-22 04:50

    (EXCEL 2007 and later)

    How to force excel not to "detect" date formats without editing the source file

    Either:

    • rename the file as .txt
    • If you can't do that, instead of opening the CSV file directly in excel, create a new workbook then go to
      Data > Get external data > From Text
      and select your CSV.

    Either way, you will be presented with import options, simply select each column containing dates and tell excel to format as "text" not "general".

    0 讨论(0)
  • 2020-11-22 04:51

    In my case, "Sept8" in a csv file generated using R was converted into "8-Sept" by Excel 2013. The problem was solved by using write.xlsx2() function in the xlsx package to generate the output file in xlsx format, which can be loaded by Excel without unwanted conversion. So, if you are given a csv file, you can try loading it into R and converting it into xlsx using the write.xlsx2() function.

    0 讨论(0)
  • 2020-11-22 04:51

    (EXCEL 2016 and later, actually I have not tried in older versions)

    1. Open new blank page
    2. Go to tab "Data"
    3. Click "From Text/CSV" and choose your csv file
    4. Check in preview whether your data is correct.
    5. In сase when some column is converted to date click "edit" and then select type Text by clicking on calendar in head of column
    6. Click "Close & Load"
    0 讨论(0)
提交回复
热议问题