Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8429603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:22:59+00:00 2026-06-10T05:22:59+00:00

The problem is not the exporting itself but how it separates the fields with

  • 0

The problem is not the exporting itself but how it separates the fields with comma’s and I have commas in the fields. All works fine until it gets to the last field where the string contains a comma, it delimits it

My code:

  foreach (var item in jobSortedReportData)
  {
       sb.Append("\"").Append(item.Title).Append("\",\"").Append(item.Total).Append("\",\"").Append(item.Week6).Append("\",\"").Append(item.Week5).Append("\",\"").Append(item.Week4).Append("\",\"").Append(item.Week3).Append("\",\"").Append(item.Week2).Append("\",").Append(item.Week1).Append(Environment.NewLine);                     
  }

  byte[] textBytes2 = Encoding.UTF8.GetBytes(sb.ToString());

the output this generates:

 Number 1 Job Search    0   **Bathroom Fitter, Plumbing: 100**  Carpenter, Joinery: 99  Carpenter, Joinery: 81  Carpenter, Joinery: 209 Electrician, Domestic Electrical: 495   **Bathroom Fitter    Plumbing: 112**
 Number 2 Job Search    0   Carpenter, Joinery: 97  Bathroom Fitter, Plumbing: 99   Bathroom Fitter, Plumbing: 79   Bathroom Fitter, Plumbing: 150  Bathroom Fitter, Plumbing: 453  Builder  Window Installation: 75
 Number 3 Job Search    0   Builder, Window Installation: 85    Building Contractor, Kitchen Fitting: 97    Plumber, Bathroom Fitting: 51   Builder, Window Installation: 134   Heating Engineer, Gas Installation: 451 Bathroom Fitter  Bathroom Fitting: 74

raw view:

"Number 3 Job Search","0","Builder, Window Installation: 85","Building Contractor, Kitchen     Fitting: 97","Plumber, Bathroom Fitting: 51","Builder, Window Installation: 134","Heating Engineer, Gas Installation: 451",Bathroom Fitter, Bathroom Fitting: 74 
"Number 1 Tradesmen Search","0","Painter & Decorator: 316","Painter & Decorator: 229","Painter & Decorator: 146","Builder: 324","TV Aerials & In-home Entertainment Installer: 1378",Electrician: 247 
"Number 2 Tradesmen Search","0","Builder: 171","Builder: 191","Plumber: 114","Plumber: 295","Builder: 551",Builder: 205 
"Number 3 Tradesmen Search","0","Plumber: 123","Plumber: 160","Builder: 108","Painter & Decorator: 231","Domestic Electrical: 495",Painter & Decorator: 160

In the above, "Bathroom Fitter, Plumbing: 100" in the 3rd column contains a , but it keeps the whole string in one excel field. When it comes to the last column "Bathroom Fitter Plumbing: 112" there is a , in the string between Fitter and Plumbing, so what happens now is this , is seen as a separator so when in excel it split this in TWO cells, thus I have Bathroom Fitter in one cell and Plumbing:112 in the next. The whole string should be in ONE cell. It does this only on the last column?? please help me correct this.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:23:01+00:00Added an answer on June 10, 2026 at 5:23 am

    Its hard to see with out the raw csv but rememeber that you need to use text qualifiers if a CSV field contains commas to prevent it thinking it is a column. So the raw CSV should look like this to get consistent results:

    “Bathroom Fitter, Plumbing: 100”,next column, “column with comma”.

    EDIT: Now I have seen the raw shouldn’t the code look like this at the end? I don’t think your adding the text qualifiers on the last field:

    ...Append(item.Week2).Append("\",\"").Append(item.Week1).Append("\"").Append(Environment.NewLine);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried searching over the internet about this problem but not able to
I have a similar problem to this guy: Importing/Exporting Project Preferences , but my
my problem is not about memory leakage, but about memory purge of node.js (expressjs)
This problem is not readily reproducible in a simple example here but was wondering
I'm trying to debug this problem but not sure where exactly i need to
I am stuck with a simple problem but not able to figure out the
I have a large project that executes without problem when not debugging (even when
I am using TortiseSVN and we have a problem when we exporting etc because
I have a problem with Crystal Reports 8. When exporting a report from my
I have problem with exporting my work in eclipse. When i export it does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.