Questions tagged [csvhelper]

The CsvHelper library is a .NET library that allows for easy reading and writing of comma-separated values (CSV) files.

The CsvHelper library is a .NET library that allows for easy reading and writing of comma-separated values (CSV) files. The library aims to be fast and easy to use. One of the most notable features is that it allows reading of writing of objects directly from/to a .csv file.

Links

861 questions
-1
votes
1 answer

Using CSVHelper to read a CSV file and need to extract columns to arrays

I have this code here that works how I want, but I'm developing on .Net Standard and cannot use the Microsoft.VisualBasic.FileIO library. I would like to be able to do the same thing using CsvHelper Is it possible with CsvHelper to, first get the…
-1
votes
1 answer

CSV reading in C#, I just want to read some fields

I want to read a csv file that has 9 columns with headers and many data rows below, but I am just interested in three of the columns, and they are not contiguous. I have tried with this code but it doesn't work, it stops in the foreach loop with a…
-1
votes
1 answer

How to serialize the right class when there are several with CSVHelper

I would like to know if it is possible to serialize the right class when there are several different with CSVHelper, ex : There are two classes, A and B, when I load the data from a CSV file(it has been exported from Class A or B), the data will be…
Bensuperpc
  • 1,275
  • 1
  • 14
  • 21
-1
votes
1 answer

CsvHelper parse text in a table which is not delimited

Here is my data set which has come from a command which i have no control over the output: BOOLEANCOLUMN NAME CLUSTER AUTHINFO someName someCluster SomeMoreData * name2 …
Mr Giggles
  • 2,483
  • 3
  • 22
  • 35
-1
votes
1 answer

Error exporting to CSV when there are reference maps

I have s Student class where each student record has a list of Results. I need to export there results to CSV and I'm using CsvHelper. public class Student { public string Id { get; set; } public string Name { get; set; } public Result[]…
RN92
  • 1,380
  • 1
  • 13
  • 32
-1
votes
1 answer

How to efficiently write a csv file with thousands of columns using csvhelper?

I am working on measurement software from which results are written to a huge list of lists which I am trying to put into .csv file using csvhelper. Problem is that to keep things fairly readable and I need to create thousands of columns and I don't…
Vafail
  • 19
  • 3
-1
votes
1 answer

CsvHelper isn't parsing csv

I'm trying to use CsvHelper to parse a csv file and get an array of class objects. But I can't get any results from CsvReader. What am I doing wrong? TextReader reader = File.OpenText("test.csv"); string stringResult=reader.ReadToEnd(); //this…
Matthew
  • 4,149
  • 2
  • 26
  • 53
-1
votes
1 answer

How to get csvHelper to write csv as text

I have the following code using (StreamWriter streamwriter = new StreamWriter(savetopath)) { using (CsvWriter csv = new CsvWriter(streamwriter)) { List columns = new List(); foreach (DataColumn column in…
user3333280
-1
votes
1 answer

Entity Framework incorrect seed

I have 2 simple model classes: public class Category { public int Id { get; set; } public string Description { get; set; } public ICollection SubCategories { get; set; } } public class SubCategory { public int Id {…
kaycee
  • 1,199
  • 4
  • 24
  • 42
-2
votes
1 answer

CSVHelper How to read two csv file and join them based on ID in C#

I am trying to read two CSV files using CSVhelper in my C# program. Both files have the same ID, but one has missing information that needs to be patched and saved to the list. For example: project1.csv has the following info: SN ID Name 1 245 …
-2
votes
1 answer

how to get list of missing header columns of csv file?

I have a functionality to upload the CSV file. And in any case I am getting one of the column exception while uploading the csv file. I am using CsvHelper to perform related csv operations. And the problem is how we can get the list of missing…
sunil
  • 145
  • 1
  • 12
-2
votes
1 answer

Convert value to int

I am trying to convert a value from a CSV file using CsvHelper. The value itself is an integer but the value inside the csv contains a whitespace e.g. "0 " or "12 ". How can I get it to work now? On StackOverFlow I found this thread but the trimming…
Marvin Klein
  • 1,436
  • 10
  • 33
-2
votes
2 answers

CsvHelper type conversion, column with string and ints to int

I have a contrived csv file "Id","Name" "10","Foo" "Team1Id","Joe" "Team1Id","Blogs" "Team2Id","Foo Bar" public class MyClass { public int Id { get; set; } public string Name { get; set; } } public class MyClassMap :…
markD
  • 1
  • 1
  • 1
-2
votes
1 answer

Reading a CSV file using CsvHelper

I'm a newbie. I want to get data from the CSV file-the Id and Name fields, but when I run the reading method, I get only 100 lines of an incomprehensible type: "CsvHelper.CsvReaderd__87`1[Program+Product]". I do not know how to get data from CSV, I…
Otto Rahn
  • 143
  • 2
  • 10
-2
votes
1 answer

How to add a new column to a CSV and write it back to another CSV using CSVHelper

I have a csv file with many columns that I want to read and then add a new column to CSV and write it back. I can read it into a dynamic object, but how can I add a new column to it? I am using CSVHelper. I don't want to define a class to read the…
mans
  • 17,104
  • 45
  • 172
  • 321
1 2 3
57
58