web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CSV formatter to create cases in dynamics crm

(0) ShareShare
ReportReport
Posted on by 244

Hi All,

I am using a console app to create cases from csv flat file.

i am using the , delimiter to separate field values.

But my issue is I am receiving data like,

string[] val=data1,"data,2",date;

So, it is getting separated as :     val[] is data1,data,2,date

but it should be data1,data2,date.

any suggestions?

*This post is locked for comments

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at

    I don't know if there are any .Net classes that could help with this, though you may be able to find one. Another option could be to use tools that are designed to import csv files - e.g. SQL Management Studio or Excel to import the data, then export in a format that's easier for you

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    You could use the CSV helper to map to C# objects, i found this very useful in scenarios like mentioned you above

    joshclose.github.io/CsvHelper

    github.com/.../932

  • Suggested answer
    Joseph McGregor Macdonald Profile Picture
    597 on at

    Another option is to use an OLEDB connection to the CSV file. I frequently do this and it works well. The .NET library returns a list of rows with indexers for all the columns in the CSV file

    This is some sample code which results in the dTable object's Rows property containing the rows in the CSV

    var folderContainingCsv = @"C:\ExampleFolderName";
    var csvFileName = "ExampleCsv.csv";
    var connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"
               + "Data Source=\"" + folderContainingCsv + "\\\";"
               + "Extended Properties=\"text;HDR=Yes;FMT=Delimited\"";
    var sql = "select * from [" + csvFileName + "]";
    
    var dTable = new DataTable();
    using (var dAdapter = new OleDbDataAdapter(sql, connectionString))
    {
        dAdapter.Fill(dTable);
    }


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans