0

Language: C#

I want to output my data in a csv file. The data retrieval and display is working already but is it possible to display data per group in a separate TAB when user opens the CSV?

Right now, I am using a 'comma' as a separator and my data looks like this when I open the CSV:

enter image description here

What I wanted to accomplish is for the second group of data under "Name" and Gender" to be output in a separate tab for example:

enter image description here

So in the end, first tab is for the NAME and AGE. Second tab is for the NAME and GENDER. Is this feasible to achieve? Thank you.

3
  • 1
    I think "Tab" is excel concept...
    – Ian
    Mar 2, 2016 at 2:25
  • Yes, you save it as *.csv but then you can open using excel.
    – JADE
    Mar 2, 2016 at 2:27
  • 1
    What I am trying to say is that you can create CSV files and open it with Excel, and in Excel you can add Tab, but I think the CSV format itself doesn't have concept of Tab. Thus it maybe impossible to do what you want if the format is pure CSV and not doing it with Excel (which open CSV file as one of its worksheet, but you still use Excel and therefore can create tab in Excel - not due to the CSV file itself you can create tab. The concept may not exist).
    – Ian
    Mar 2, 2016 at 2:30

1 Answer 1

3

No, you cannot create multiple "sheets" within a pure CSV file. Tabs are an Excel-only concept and are not part of most raw file formats.

I would recommend using Office interop or a third-party library to generate native excel documents,

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.