FRENDS Tasks to process CSV files. .NET Standard compliant
You can install the task via FRENDS UI Task view, by searching for packages. You can also download the latest NuGet package from https://www.myget.org/feed/frends/package/nuget/Frends.Csv and import it manually via the Task view.
Clone a copy of the repo
git clone https://github.com/FrendsPlatform/Frends.Csv.git
Restore dependencies
nuget restore frends.csv
Rebuild the project
Run Tests with nunit3. Tests can be found under
Frends.Csv.Tests\bin\Release\Frends.Csv.Tests.dll
Create a nuget package
nuget pack nuspec/Frends.Csv.nuspec
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
Property | Type | Description |
---|---|---|
Csv | string | Input csv as a string |
Delimiter | string | The separator used in the csv string |
ColumnSpecifications | ColumnSpecification[] | Used for mapping csv columns into types. The order of the columns are used for mapping. This is optional and if you dont need to parse the csv elements into known types. |
Property | Type | Description |
---|---|---|
Name | string | Name of the column. Does not have to match the one in the csv string. The order of the ColumnSpecification elements are matched ot the order of columns in the csv string |
Type | Enum{String, Int, Long, Decimal, Double, Boolean, DateTime, Char} | Type of the resulting column |
Property | Type | Description |
---|---|---|
ContainsHeaderRow | bool | This flag tells the reader if there is a header row in the CSV string. Default is true. |
SkipRowsFromTop | int | This value is set to ignore a specific amount of rows from the beginning of the csv string. This can for example be used if the string contains some metadata on the first row before the header. |
SkipEmptyRows | bool | A flag to let the reader know if a record should be skipped when reading if it's empty. A record is considered empty if all fields are empty. |
TrimOutput | bool | This flag tells the reader to trim whitespace from the beginning and ending of the field value when reading. |
ReplaceHeaderWhiteSpaceWith | string | This flag tells the reader to replace possible whitespace in the header field with specific string. Default action is to do nothing. Is only applied on headers originating fron the CSV header row |
CultureInfo | string | The culture info to parse the file with, e.g. for decimal separators. InvariantCulture will be used by default. See list of cultures here; use the Language Culture Name. NOTE: Due to an issue with the CsvHelpers library, all CSV tasks will use the culture info setting of the first CSV task in the process; you cannot use different cultures for reading and parsing CSV files in the same process. |
TreatMissingFieldsAsNull | bool | This flag tells the reader to treat missing fields as null instead of throwing an MissingFieldException. The Xml -representation of null value is a self closing tag. |
IgnoreReferences | bool | A flag to let the reader know if reference should be ignored. |
IgnoreQuotes | bool | A flag to let the reader know if quotes should be ignored. |
Property/Method | Type | Description | Example |
---|---|---|---|
Data | List<List> | Result Data contains each data row from the input csv | [["Example", 5, true], ["Other", 4, false]] |
Headers | List | Result Headers contain the header row of the input csv/ColumnSpecifications | ["Name", "Id", "IsMember"] |
ToJson() | JToken | Converts the Data and Headers to a Json array | [{"Name": "Example", "Id": 5, "IsMember": true}, {"Name": "Other", "Id": 4, "IsMember": false}] |
ToXml() | string | Converts the Data and Header to a xml string | <Root> <Row><Name>Example</Name><Id>5</Id><IsMember>true</IsMember></Row> <Row><Name>Other</Name><Id>4</Id><IsMember>false</IsMember></Row> </Root> |
Property | Type | Description | Example |
---|---|---|---|
InputType | Enum { List, Json } | Select input type | |
Json | string | If InputType is Json this field will be visible and used. Input needs to be an Array of Objects | [ {"Header1": "Value1", "Header2": "Value2"}, {"Header1": "Other1", "Header2": "Other2"} ] |
Headers | List | If inputType is List this field will be visible and used. Headers for the Data. Need to be in the same order as the underlying Data | new List<string> {"Header1", "Header2"} |
Data | List<List> | If inputType is List this field will be visible and used. The order of the nested list objects need to be in the same order as the header list. | new List<List<object>>() { new List<object> {"Value1", "Value2"}, new List<object> {"Other1", "Other2"} |
Delimiter | string | The separator used in the csv string | ; |
Property | Type | Description |
---|---|---|
IncludeHeaderRow | bool | This flag tells the writer if a header row should be written. |
CultureInfo | string | The culture info to write the file with, e.g. for decimal separators. InvariantCulture will be used by default. See list of cultures here; use the Language Culture Name. NOTE: Due to an issue with the CsvHelpers library, all CSV tasks will use the culture info setting of the first CSV task in the process; you cannot use different cultures for reading and parsing CSV files in the same process. |
NeverAddQuotesAroundValues | bool | If set true csv's fields are never put in quotes |
ReplaceNullsWith | string | Input's null values will be replaced with this value |
ForceQuotesAroundValues | bool | Force quotes around all values |
Property/Method | Type | Description |
---|---|---|
Csv | string | Resulting csv string |
This project is licensed under the MIT License - see the LICENSE file for details