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 7408977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:00:15+00:00 2026-05-29T06:00:15+00:00

I have a .csv file(I have no control over the data) and for some

  • 0

I have a .csv file(I have no control over the data) and for some reason it has everything in quotes.

"Date","Description","Original Description","Amount","Type","Category","Name","Labels","Notes"
"2/02/2012","ac","ac","515.00","a","b","","javascript://"
"2/02/2012","test","test","40.00","a","d","c",""," "

I am using filehelpers and I am wondering what the best way to remove all these quotes would be? Is there something that says “if I see quotes remove. If no quotes found do nothing”?

This messes with the data as I will have "\"515.00\"" with unneeded extra quotes(especially since I want in this case it to be a decimal not a string”.

I am also not sure what the “javascript” is all about and why it was generated but this is from a service I have no control over.

edit
this is how I consume the csv file.

    using (TextReader textReader = new StreamReader(stream))
        {
            engine.ErrorManager.ErrorMode = ErrorMode.SaveAndContinue; 

            object[] transactions = engine.ReadStream(textReader);
        }
  • 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-05-29T06:00:16+00:00Added an answer on May 29, 2026 at 6:00 am

    You can use the FieldQuoted attribute described best on the attributes page here. Note that the attribute can be applied to any FileHelpers field (even if it type Decimal). (Remember that the FileHelpers class describes the spec for your import file.. So when you mark a Decimal field as FieldQuoted, you are saying in the file, this field will be quoted.)

    You can even specify whether or not the quotes are optional with

    [FieldQuoted('"', QuoteMode.OptionalForBoth)] 
    

    Here is a console application which works with your data:

    class Program
    {
        [DelimitedRecord(",")]
        [IgnoreFirst(1)]
        public class Format1
        {
            [FieldQuoted]
            [FieldConverter(ConverterKind.Date, "d/M/yyyy")]
            public DateTime Date;
            [FieldQuoted]
            public string Description;
            [FieldQuoted]
            public string OriginalDescription;
            [FieldQuoted]
            public Decimal Amount;
            [FieldQuoted]
            public string Type;
            [FieldQuoted]
            public string Category;
            [FieldQuoted]
            public string Name;
            [FieldQuoted]
            public string Labels;
            [FieldQuoted]
            [FieldOptional]
            public string Notes;
        }
    
        static void Main(string[] args)
        {
            var engine = new FileHelperEngine(typeof(Format1));
    
            // read in the data   
            object[] importedObjects = engine.ReadString(@"""Date"",""Description"",""Original Description"",""Amount"",""Type"",""Category"",""Name"",""Labels"",""Notes""
    ""2/02/2012"",""ac"",""ac"",""515.00"",""a"",""b"","""",""javascript://""
    ""2/02/2012"",""test"",""test"",""40.00"",""a"",""d"",""c"","""","" """);
    
            // check that 2 records were imported
            Assert.AreEqual(2, importedObjects.Length);
    
            // check the values for the first record
            Format1 customer1 = (Format1)importedObjects[0];
            Assert.AreEqual(DateTime.Parse("2/02/2012"), customer1.Date);
            Assert.AreEqual("ac", customer1.Description);
            Assert.AreEqual("ac", customer1.OriginalDescription);
            Assert.AreEqual(515.00, customer1.Amount);
            Assert.AreEqual("a", customer1.Type);
            Assert.AreEqual("b", customer1.Category);
            Assert.AreEqual("", customer1.Name);
            Assert.AreEqual("javascript://", customer1.Labels);
            Assert.AreEqual("", customer1.Notes);
    
            // check the values for the second record
            Format1 customer2 = (Format1)importedObjects[1];
            Assert.AreEqual(DateTime.Parse("2/02/2012"), customer2.Date);
            Assert.AreEqual("test", customer2.Description);
            Assert.AreEqual("test", customer2.OriginalDescription);
            Assert.AreEqual(40.00, customer2.Amount);
            Assert.AreEqual("a", customer2.Type);
            Assert.AreEqual("d", customer2.Category);
            Assert.AreEqual("c", customer2.Name);
            Assert.AreEqual("", customer2.Labels);
            Assert.AreEqual(" ", customer2.Notes);
        }
    }
    

    (Note, your first line of data seems to have 8 fields instead of 9, so I marked the Notes field with FieldOptional).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file in the following format: id,code,date,address,complete_url Example data from the
I have a CSV file that has only 1 column, but has close to
I have a CSV file with several entries, and each entry has 2 unix
I have a CSV file which has the following format: id,case1,case2,case3 Here is a
I have a csv file that has like 30,000 rows in it. It also
I have a csv file which has two columns, a numeric ID ( IDVAR
I have CSV file which has timestamp in the first column as shown below
I'm reading a .csv file (I have no control of the format of the
I am trying to do some test with jMeter. I have CSV file with
I have CSV file and Macro in VBA. I want to open CSV file

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.