Forum Discussion

jeff-125's avatar
jeff-125
Copper Contributor
Feb 24, 2023

Automatic Date Format When Generating a CSV from Software

Hello,

 

When I generate a .CSV of data from my database I am getting an automatic format change to DATE in a column that contains a dashed numbering system used in my database. Ex:  5-12-01 

 

I need to keep the dashed numbering format without it automatically changing it to DATE. When I change the formatting to text, it will be a 5 digit number. EX:  5-22-01 is automatically changed to 5/22/2001 and when format is changed to text if becomes 37033

  • JoeUser2004's avatar
    JoeUser2004
    Bronze Contributor

    jeff-125  wrote:  ``When I generate a .CSV of data from my database [....] I need to keep the dashed numbering format``

     

     

    Excel writes the data to the CSV file exactly as it appears in the originating Excel file.

     

    Open the CSV file with Notepad to confirm.

     

    If that is your only concern -- how the data will appear to a recipient of the file -- there is no problem.

     

    -----

     

    Any "reformatting" occurs only when the CSV file is opened directly in Excel.

     

    Excel interprets the CSV data exactly as if we had typed it manually into a cell that is formatted as General.

     

    You might work around that by importing the CSV into Excel instead of opening it directly.  That is, click Data > Get External Data > From Text and follow the prompts to choose how the input column should be interpreted.

     

    But we cannot control how a(nother) recipient of the CSV file might open it.

     

    • jeff-125's avatar
      jeff-125
      Copper Contributor

      JoeUser2004 Thank you.

       

      I was able to do a work around as the .CSV is generated by the software I use to store my data. Reason for .CSV is so I can import it into Google Earth. The dashed numbers are a labeling method for those points.

       

      I was able to format the data through a report that matched the .CSV in .XLSX that kept my dashed format. Then I created a text formatted column and copy and pasted to the .CSV. Not the best solution as I have many blank rows which create GPS points at 0, but it works.

  • tauqeeracma's avatar
    tauqeeracma
    Steel Contributor

    HIjeff-125 

     

    There is one possibility if you import CSV data into excel and while importing select the TEXT format as mentioned below, your data may not change into the date format.

     

     

    Hope it will help.

     

    Thanks

    Tauqeer

    • jeff-125's avatar
      jeff-125
      Copper Contributor
      Thank you for your response!

      I will try this.

Resources