+ Reply to Thread
Results 1 to 3 of 3

Output to CSV format from cmd.exe?

  1. #1
    Registered User
    Join Date
    03-22-2017
    Location
    Westlake Village, CA
    MS-Off Ver
    2016
    Posts
    24

    Output to CSV format from cmd.exe?

    Hello, I am looking for the commands to help format a CSV file.

    Example:
    -o "C:\FriedmanBros.csv" -h-1 -s"," -w 400

    I understand '-h' removes the headers, but Id like to know what is possible...

    OR if there is a way, without human interaction, for a way to covert CSV to Excel (silently)

    I am trying to Output some data from SQL MS to a readable format/output for a client.

    Thank you!
    Chris

  2. #2
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,206

    Re: Output to CSV format from cmd.exe?

    Depends what you mean by convert. CSV is a file format, Excel is not. Excel has its own file formats (.xls, .xlsx, .xlsm, .xlsb, etc.) which is likely what you are looking for.

    A couple points. You can open a CSV in Excel, conversion is only required to leverage formulas and features of Excel after saving and closing said file (otherwise its stripped out when saved as and opened as csv again).

    Just about any way you look to do this will require opening Excel (regardless of if you notice it opening or not). Otherwise you are likely looking at 3rd party software that provides access via the command line.

    If you google converting csv to excel in the command line there are plenty of results using various methods, VBA, Python, VBS, etc. Pick your poison. Assuming the command you gave is in Windows CMD, I doubt there is any built in tool/command that can convert to MS Office file types. Most commands are going to open an instance of Excel (possibly without showing it) and save the file to the desired format.

    You should be very careful with any code/automated method of doing this to ensure it doesnt cause other problems (like overwriting the original). Test your code on dummy files in a dummy location before using in production.

  3. #3
    Forum Expert
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2003, Excel 2007 & reluctant Excel 2010 user
    Posts
    4,231

    Re: Output to CSV format from cmd.exe?

    if there is a way, without human interaction, for a way to covert CSV to Excel (silently)
    Perhaps like this but not sure the result will make you happy.

    Please Login or Register  to view this content.
    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1