Header Row in CSV to be Seperated with no commas

  • Hi All,

    I've been asked to create an export that has a header row with numerous bits of data in (for example the name of the report and the date). The file needs to export as a CSV however the end user has requested that the header row be split when the report is opened in Excel but stays as a continuous line (no commas) in Notepad.

    I'm of the mind that somewhere along the line communications have become confused and the commas are required as i don't think this is possible however i wanted to see if anyone did know of a way to do this.

    Thanks

    Matt

  • clarmatt73 (2/1/2011)


    Hi All,

    I've been asked to create an export that has a header row with numerous bits of data in (for example the name of the report and the date). The file needs to export as a CSV however the end user has requested that the header row be split when the report is opened in Excel but stays as a continuous line (no commas) in Notepad.

    I'm of the mind that somewhere along the line communications have become confused and the commas are required as i don't think this is possible however i wanted to see if anyone did know of a way to do this.

    Thanks

    Matt

    Use the TAB character instead of commas to meet this requirement.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hi Jeff,

    Thanks for your reply, unfortuntly the end user doesn't want any spaces in the Header Row when it is in Note Pad, if you use Tab it puts a space between each part of the header.

    Matt

  • what method are you using to do this export?

  • Eventually the export needs to be automated, at the moment however i am running it stright out of SSMS 2008.

  • It would be possible to remove the delimiter from the header and leave it in the body of the data, however this will not open correctly in excel.

    Is it possible to create two exports, one that opens in notepad and one that opens in excel?

  • The report needs to be sent over to one of our clients in one report. I'm glad i'm not the only one that struggled with this, i was worried there was going to be a simple explanation and i'd end up looking stupid.

  • clarmatt73 (2/1/2011)


    Hi Jeff,

    Thanks for your reply, unfortuntly the end user doesn't want any spaces in the Header Row when it is in Note Pad, if you use Tab it puts a space between each part of the header.

    Matt

    Heh... the things users ask for. I don't know of a way to get Excel to "split" the header without some in-row character to indicate where the split will be and even "non-printable" characters will show up as little boxes in NotePad.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • That would involve finding a character that excel recognises and that notepad ignores completly, not sure if that is possible at all..

  • Tell me about it, i'm hoping that somewhere along the line wires have got crossed and the file does actually need the commas in the header. Thanks for the responses, least i know i was right to say it isn't possible.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply