Questions tagged [filehelpers]
FileHelpers is a .net utility library to help applications manage flat file input and output.
445
questions
0
votes
0
answers
23
views
Parsing fields with commas using FileHelper's FixedLengthRecord
I am parsing a text file from an old financial program and there are no built-in delimiters. So, a row can look just like this
Header Col1 Col2 Col3
Detail HydraSparkWarehouse33.00
The Col1 ...
0
votes
1
answer
62
views
Any idea why private property and variable behave differently in FileHelpers?
To simplify the case, let say I have the following class
public class TestFileHelpersClass
{
[FieldOrder(1), FieldFixedLength(20), FieldTrim(TrimMode.Both)]
public string ...
-2
votes
1
answer
35
views
What's the "best practice" for when to create a FileHelpers engine?
I have a class in a Windows Forms application that is processing at peak 10 - 20 records per minute, but at non-peak it might go two or three hours without doing anything.
As I see it, you can ...
0
votes
1
answer
75
views
FileHelper reading in CSV where initial row specifies column names
For context I'm trying to parse in a 7dtd localization file. The contents of the file looks something akin to this:
Key,File,Type,UsedInMainMenu,NoTranslate,english,Context / Alternate Text,german,...
0
votes
1
answer
54
views
FileHelpers - Subclassing with FixedLengthRecords
I am working with a file which has multiple possible permutations of line format depending on an element subject to change. All permutations share length, the difference lies in elements being filled/...
0
votes
1
answer
31
views
Saving and Loading file definitions while using <generic> version of FileEngine
I've successfully use the SaveToXml and LoadFromXml methods on the ClassBuilder class to store and retrieve the file definitions while using the Standard version of the File Helper Engine.
However I'd ...
0
votes
0
answers
39
views
Why DataTable columns are read-only when loaded from CSV using FileHelpers? [duplicate]
Scenario 1 :
Loading datatable from SQL Server database is working fine.
I also can update data with no issues in that datatable:
SqlConnection conn = new SqlConnection(gDBConn);
SqlCommand cmd = new ...
3
votes
1
answer
163
views
How to make FileHelpers ignore columns after the defined columns? (i.e. ignore columns at the end)
Suppose I have the following FileHelpers Record definition:
[DelimitedRecord(",")]
[IgnoreEmptyLines]
public class TestRecord
{
[FieldCaption("A")]
[FieldQuoted(QuoteMode....
1
vote
1
answer
45
views
How do you use FileHelpers.engine with F# option types using generic converters?
This answer shows a nice way to use CsvHelper with generic F# option types. How do you do the same thing with FileHelpers?
I cannot figure out how to make the generic OptionConverter work. Consider ...
0
votes
1
answer
211
views
How do I append to a CSV file using Filehelpers with multiple record types that have distinct headers?
As the question says, using the FileHelpers library I am attempting to generate a CSV file along side a report file. The report file may have different (but finite) inputs/data structures and hence ...
0
votes
1
answer
121
views
Read delimited record containing delimited field with varying length with FileHelpers in C#?
I am using MultiRecordEngine() to read a delimited .txt file with no header and different type of records. The first two character of any record is the identifier which I am using to identify the type ...
0
votes
1
answer
165
views
Is there a way, for a C# application using FileHelpers library, to store and load the file structure class without compiling it in the executable? [closed]
I am thinking of something like a config, xml, or JSON file. But I have not found any such solution.
Perhaps FileHelpers doesn't have this functionality outside of the compiled assembly, but this is a ...
0
votes
1
answer
66
views
is there a way to create a 'Generic' CSV file format with FileHelpers
I would like to use FileHelpers to read a CSV file with an unknown file layout (except that it is comma delimited). I would basically like to have a string[] for row where each item is a field. Is ...
3
votes
1
answer
37
views
Problems with converting FixedLength format to to csv using same class definition
I defined both FixedLength and Delimited attributes on a single class. It reads the fixed length file fine but fails when i try to write out a csv.
[FixedLengthRecord]
[DelimitedRecord(",")]
...
0
votes
2
answers
457
views
Write data to a .DAT file with Pipe Delimiter in .NET Core 2.1 version
I was using File Helpers .Net Framework. But when i started using .Net Core 2.1, File Helpers is not compatible. Can someone tell me an alternate was to write a pipe delimiter .Dat file.
Public class ...
-1
votes
3
answers
61
views
Filehelpers some columns are not written
I am writing this class to a file. But for some reason, some of the rows have some columns missing.
By this, I mean that some columns are shifted a few times to the left. I can see this on the last ...
0
votes
1
answer
121
views
How I can convert data format in filehelpers c#
I'm trying read this date 03/01/2020 00:17:41 from a .csv file, but when I try to convert to date with
[FieldConverter(ConverterKind.Date, "dd/MM/yyyy HH:mm:ss")]
public DateTime Field01_Fecha;
The ...
0
votes
2
answers
110
views
Last Delimiter in CSV file with FileHelpers
I must develop a CSV-Export with 57 columns.
After the last column i need the delimiter and then the LFCR.
Example:
Now i have
aaaa;bbbb;cccc;dddd
But i need
aaaa;bbbb;cccc;dddd;
Which ...
0
votes
1
answer
100
views
CSV Import with GUID failing
Looking for some quick help.
I am importing a CSV file that has 2 columns ID & Name. ID is a GUID and name is a String, as below:
c4f8da96-b991-457e-9fd5-94e532ffcd06,Location99
c4f8da96-b991-...
0
votes
1
answer
157
views
FileHelpers.ConvertException using format dd/MM/yy HH:mm
I have a column in CSV with value: 14/04/20 09:44
FECHA_FRANQUEO|ID_INCIDENCIA|CIF|PERSONA_CONTACTO
14/04/20 09:44|7093927|bbbbbbbbb|RAFA
14/04/20 09:02|7093933|aaaaaaaaa|Maria / Roger
I use ...
1
vote
0
answers
266
views
Can not read Excel File using NuGet FileHelpers.ExcelNPOIStorage
I have a problem with reading file using ExcelNPOIStorage.
Error Code:
System.MissingFieldException: 'Field not found: 'NPOI.SS.UserModel.MissingCellPolicy.CREATE_NULL_AS_BLANK'.'
Code:
var ...
0
votes
2
answers
49
views
Configuring FileHelpers DateTimeConverter format at runtime
I have a need to import a CSV file, but need my users to be able to select the date format their CSV file is using for dates.
Currently, I have my date property declared as
[FieldOrder(3)]
[...
0
votes
1
answer
160
views
How to use FileHelper library to get number of delimiters
Using the FileHelper Library Is there a way to get an exception if the record does not have expected number of delimiters in a line?
And another question is there is there a way to get an exception ...
0
votes
1
answer
131
views
how to call FileHelpers.RecordTypeSelector correctly?
I'm working with FileHelpers: https://www.filehelpers.net/
I have a source file which contains a set of approximately 10 different RecordTypes. To accommodate, I intend to use a MultiRecordEngine (...
1
vote
2
answers
179
views
ASP.net FileHelpers failed to convert string to datetime
I work on this issue since almost 2 days. Here is the error message:
FileHelpers.ConvertException: 'Error Converting '8/8/2018 8:48:52 AM'
to type: 'DateTime'. There are less chars in the Input ...
2
votes
1
answer
81
views
C#.NET: Read CSV using % converter
I'm reading a CSV file
Name,Score
Pat,99%
Chris,87%
and would like to discard the percent sign when the file is read through FileHelpers
using FileHelpers;
public class PctConverter : ...
0
votes
1
answer
399
views
How could I write to a file a dynamic object using FileHelpers?
I'm actually pursuing a way to create csv file which records could vary on type and order. They are defined by the user on both ways and I'm actually handling their types safely.
I loved using ...
0
votes
0
answers
69
views
how to limit writing a file using filehelpers C#
I need to manage a text file upto 3gb size. I'd like to keep the file under 3gb with new text being added to the end of the file and text at the beginning of the file being removed. I am experimenting ...
0
votes
1
answer
142
views
How do we read the last line of a csv file using filehelper class and then ignore the last line
How do we read the last line of a csv file using filehelper class and then ignore the last line. Or How do i ignore last line from csv file using filehelper then get the last line to a variable
...
-1
votes
1
answer
153
views
C# importing csv file into SQL database using FileHelpers
i'm trying to import a .csv file using the great FileHelpers library.
Doing some research most of the time i read that i should use BulkCopy to import the result into an SQL database table.
Could you ...
0
votes
1
answer
482
views
FileHelpers will only parse datetime if date string matches universal time format
My datetime field will only parse if the formatter is set to the universal time format and the date time is already in that format. Is this an expected behavior, or should it be able to take any ...
0
votes
2
answers
291
views
How to map a txt by column and line with FileHelpers lib
I'm wondering how could I get the column items from a txt file and write it on a output after formated.
This is my input.txt
DC 2INCL1 50000 20190802<
DC 2INCL2 50000 ...
0
votes
1
answer
181
views
Import CSV with Dynamic Columns
My Vendor is providing a CSV file where columns (names included on first line) are dynamic - meaning they will only appear if there is data in them and there is no guarantee on the order the columns ...
0
votes
0
answers
204
views
FileHelpers .Net library Error - delimeter found after the last field of the class
Visual Studio 2019, .Net Core 2.2 - getting the following error when debugging code to parse a csv file with 10 rows, using the FileHelpers .Net library:
{"Line: 2 Column: 593. Delimiter ',' found ...
1
vote
1
answer
35
views
Using the FileHelpers nuget package to read barcodes
Hello i'm using the FileHelpers nugets library to read from a barcode. Here's a sample of it :
(3102)011780(10)772890
and here is my filehelpers class :
class ReadBareCodes
{
[...
1
vote
1
answer
540
views
Read, modify and write using FileHelperAsyncEngine
I am new to FileHelper so bear with me.
I want to read an existing .csv file that has one of the columns with no data.
Next I want to populate that column from a db (the code attached is just putting ...
0
votes
1
answer
182
views
Sorting a List array and delete duplicate rows based on column values [closed]
I have a CSV file with about 40 columns. I use FileHelpers to read the file and extract a single column to perform additional operations later in the code.
The extracted list of string contains ...
0
votes
1
answer
158
views
C# filehelpers CSV DateTime exception on different system
So I got my program to do what I want, but it doesn't work on my work PC (Win 7).
When using compiled version from my home PC (Win 10) on work PC I'm
getting error "sequence has no elements" with all ...
1
vote
0
answers
87
views
Correct FIeldCoverter with date time format Filehelpers
I have a DateTime field which can be null so it needs to be left as a my question is though
[FieldConverter(typeof(NullableDateConverter))]
public DateTime? ItemNextAvailabilityDate;
How does ...
0
votes
1
answer
23
views
Cannot access lines based of header poco class
I am having the weirdest of errors.
Dim lines As List(Of NewOrderCsv) = (From record In _records Where record.Ticket2 = orderHeaderRow.Ticket2)
Their error is happening here on my declaration of the ...
2
votes
1
answer
254
views
C# CSV Filehelpers compare two rows in the same file, add and remove rows
I want to write a simple program to ease my life at work, but I'm not too familiar with C# so I'm trying to read the documentation and some examples, but I don't find the documentation too good, and ...
0
votes
1
answer
2k
views
Using FileHelpers to read a dynamic CSV to DataTable
I find FileHelpers very convenient to handle "rich" CSV, with custom separators, quoted identifiers, empty items filtering, etc.
But it mainly seem to be intended to load files with format known in ...
0
votes
1
answer
438
views
FileHelpers read csv with FieldQuoted having " character in multi lines filed
I have a trouble with read csv file with FileHelpers library like that:
I have a csv file with some lines, if the first line have " character and the second line have " character too, then the second ...
2
votes
1
answer
43
views
Is there a way to retrieve the entire line that the FileHelpers Engine is parsing
We are using FileHelpers to parse a text file into numerous entities, based on the first character in the line. Each entity is then stored in a particular database table. We would also like to store ...
3
votes
3
answers
967
views
FileHelper read to stream and download with web api
I have a list of objects which I want to download as csv file via Web Api.
However when I test this with Swagger I get no csv download.
What am I doing wrong? DailyReportContent contains 2 objects.
...
0
votes
1
answer
41
views
Class marked for Deliminted but error says not
I have the dubious task of upgrading an old vb app which is using file helpers but for some reason, it appears to be ignoring the fact that I have marked it as a delimited record.
In the form it is ...
0
votes
1
answer
505
views
Filehelpers library cannot read ™ character
I am using Filehelpers.Net library and I have a CSV file that I am trying to read.
One of the columns has the character ™.
I am getting an error
Line: 1054 Column: 357. No value found for the ...
1
vote
0
answers
314
views
How to parse a CSV file in which the first character of each line is a comma?
I have a c# CSV parser that has been working very well for months. It uses FileHelpers.CsvEngine to do the heavy lifting. My system must receive 3rd-party CSV files as-is (very difficult to go back to ...
0
votes
1
answer
59
views
Does filehelpers have classes which can support unlimited data record length?
<FixedLengthRecord(FixedMode.AllowVariableLength)>
Public Class FileRecord
<FieldFixedLength(1)>
<FieldTrim(TrimMode.Both), FieldOptional()>
Public ...
0
votes
3
answers
930
views
How can I load a CSV empty strings as a NULL in SQL Server while using FileHelpers?
I am using FileHelpers to read a CSV with the intent of loading a SQL Server table.
The CSV looks something like this:
ID, SOMESTRING
"10","Blah blah"
"11",""
"12","More blah blah"
My Record ...