Questions tagged [linqtocsv]

LINQtoCSV - popular, easy to use library to read and write CSV files.

This library makes it easy to use CSV files with LINQ queries. Its features include:

  • Follows the most common rules for CSV files. Correctly handles data fields that contain commas and line breaks.
  • In addition to comma, most delimiting characters can be used, including tab for tab delimited fields.
  • Can be used with an IEnumarable of an anonymous class - which is often returned by a LINQ query.
  • Supports deferred reading.
  • Supports processing files with international date and number formats.
  • Supports different character encodings if you need them.
  • Recognizes a wide variety of date and number formats when reading files.
  • Provides fine control of date and number formats when writing files.
  • Robust error handling, allowing you to quickly find and fix problems in large input files.
25 questions
4
votes
2 answers

LINQtoCSV | How to write text at the end of the CSV File

Is it possible to write data at the end of the csv file or one line after the end of the csv file when using LINQToCSV library. I am using LINQtoCSV and passing a List<> to write the data. my List<> is like x y z 1 4 5 1 5 3 Now…
Maverick
  • 1,396
  • 5
  • 22
  • 42
4
votes
1 answer

LinqToCSV How to eliminate Quotes around empty strings

LinqToCSV seems to be adding quotes around empty strings Is there a setting to turn this off ? Could not find anything in the documentation. Also tried sending null values instead of empty strings.. same result this is a sample CSV output generated…
SSS
  • 281
  • 2
  • 4
2
votes
1 answer

Allowing a user to select column headers to import

I'm using LINQtoCSV within a program that allows the user to import an order from a CSV file. I have all the code working however, if the CSV file doesn't have the exact column headers then it doesn't work. Below is my class that LINQtoCSV reads…
benjiiiii
  • 478
  • 10
  • 33
2
votes
1 answer

Set empty fields to null, rather than defaults when importing .CSV to SQL database

I am creating an application that can import a .csv file into an SQL database. The .csv file is read into 7 columns: Id, InvoiceAmount, InvoiceDate, InvoiceNumber, DeniedDate, DeniedReasonId, and DeniedNotes. There is an Id for every row in the…
cfly24
  • 1,882
  • 3
  • 22
  • 56
2
votes
0 answers

LINQtoCSV cannot assign IEnumerable to List - ArgumentNullException was unhandled

I have csv file that I read and store in IEnumerable data_values. The only problem is that when I want to read it with MessageBox.Show() then it throws ArgumentNullException was unhandled. I tried to do it like if(data_values != null) but it doesn't…
2
votes
1 answer

Linq to CSV : Convert data to .CSV file and return file from an action without saving file on the server

I am LinqToCsv and this tutorial to convert my data to a downloadable csv files. WHAT HAVE I DONE : I have created an action like the one shown below: public FileResult GetReportCsvData(MyFilterModel model) { var data =…
Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281
1
vote
2 answers

LinqToCsv Set Column Width

I am using LinqToCsv to export data from a database to a csv file. One of the columns is a DateTime object. Upon export, the DateTime column shows up as "#######" until I manually expand the column width to fit the entire DateTime output. Is there a…
Ultracoustic
  • 309
  • 2
  • 4
  • 14
1
vote
1 answer

LinqToCSV and decimal globalization

I'm trying to read a csv file using LingToCSV, containing decimal values with a comma a seperator instead of a point. This is one row of input: "DataField1","DataField2" "Test", "0,34" And I use this class to read it: public class Record { …
Timo Willemsen
  • 8,717
  • 9
  • 51
  • 82
0
votes
0 answers

Formatting date output with LinqToCsv with data from Linq2SQL

I use Linq2SQL to connect and retrieve data from my databases. I now need to write a csv file out and am using LinqToCsv. Nice utility as it checks for fields that need to be escaped or quoted when writing the file. Code to do this is quite…
Keith Clark
  • 609
  • 1
  • 7
  • 19
0
votes
0 answers

How Do I read a CSV containing columns that are not in the Class you are reading into with .NET using CsvContext.Read()?

I have a Business Object class containing private fields which are populated in the constructor private int mP_Id; private int mP_MerchantId; private int mP_ProductId; private decimal mP_Price; private int mP_StockCount; private string…
objecttothis
  • 45
  • 1
  • 7
0
votes
0 answers

Formatting decimal columns with LINQtoCSV

I need to format a decimal field in a .csv file that I write with the LINQtoCSV library of this format: 95.43000000 for that format 95.43. I map this field like this: [CsvColumn(Name = "Price", OutputFormat = "C")] public decimal? Price { get; set;…
Costa.Gustavo
  • 849
  • 10
  • 21
0
votes
1 answer

Empty class to use with LINQtoCSV - vb.net

I have the following in C# and I'm trying to convert it to vb.net. internal class MyDataRow : List, IDataRow { } The rest of the code I've managed to convert myself it's just the empty class that I'm struggling with. This is so I…
benjiiiii
  • 478
  • 10
  • 33
0
votes
1 answer

How to create csv with header and footer using LinqtoCsv or anything better in C#

I am trying to export data in csv format. I am using LinqToCsv to create csv. Is it possible to create footer section using LinqToCsv? Can anyone help me how to create a csv with header and footer using LinqToCsv or with anything else using C#? I…
Mukil Deepthi
  • 6,072
  • 13
  • 71
  • 156
0
votes
1 answer

Azure webjob with Linq To CSV doesn't work in production

We are importing a .csv file with around 80.000 rows. We would like to do it on a webjob because it will be repeated in the future. We are using LinqToCsv to read in the .csv and process the information. When running locally in our Console app…
Kevin Cloet
  • 2,956
  • 1
  • 19
  • 36
0
votes
1 answer

LinqToCsv - not all the rows are written to the file

I am using LinqToCsv to write data to a CSV file. I have a list of objects that has 8 number of records, however, when I write the csv to the MemoryStream and then to the disk it writes only 7 of them. The code is as follows var csvClaims =…
shigarr
  • 72
  • 1
  • 10
1
2