Help with powershell code

Welcome Forums General PowerShell Q&A Help with powershell code

Viewing 1 reply thread
  • Author
    Posts
    • #253832
      Participant
      Topics: 1
      Replies: 0
      Points: 11
      Rank: Member

      Hello everyone, I have a csv file I got from exporting data from a sql database. There are 2 columns, with 1 of them being dates/times and the other a number. When i open the file in Excel the date and time is not formatted, the default formatting for the row containing the date/time shows up as Number –> Custom –> mm:ss.0. I have to select the whole column and change formatting to Date –> mm/dd/yyyy hh:mm.

      Is there any way to automate the process using powershell and if so can you please provide the code? filename is test.csv and the rows do not have a header, they are row #1 and #2

      thank you in advance

       

      thank you in advance

      • This topic was modified 3 weeks, 4 days ago by acio15.
    • #253856
      Senior Moderator
      Topics: 10
      Replies: 168
      Points: 899
      Helping Hand
      Rank: Major Contributor

      Is there any way to automate the process using powershell

      Yes, it’s possible to manipulate csv and Excel files with PowerShell. However, for this relatively minor action it might not be worth the time to create and troubleshoot a script unless you are handling a lot of files. It might also be easier to manipulate the date/time value in PowerShell so that it is automatically recognized as a date/time by Excel, and then import the data into Excel, rather than trying to change the data format in Excel after importing.

      and if so can you please provide the code?

      No. This is a help & troubleshooting forum, not a “do my job for me” forum. People get paid for the kind of work you’re asking for.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.