CSV

Introduction

CSV is a simple file format used to store tabular data, such as a spreadsheet or database.

Supported actions

For CSV connector, YAP ensures the following actions:

  • Write files

  • Read files

Write files

List of fields available for Write files action:

Field

Type

FileName

String

Value

String

Content-type

String

Read files

List of fields available for Read files action:

Field

Type

Value

String or Array

Write CSV file

On the base of JSON, YAP writes CSV file – correct delimited text strings. JSON represents an array: array of arrays (for multiple CSV) or array of objects (for one CSV).

Fields

Name

Type

Required

Description

field

Object

Yes

Selecting field of data to back up and keep during processing.

variable

String

Yes

Variable for a stored file.

fileName

String

Yes

Specific system name for a file name.

delimiter

String

No

The delimiting character. Default parameter: semicolon (;).

header

Boolean

No

If a boolean value is true, the first row of parsed data will be interpreted as field names. An array of field names will be returned into metadata, and each row of data will be an object of values entered by field name instead of a simple array. For example, you have two arrays: if the first-array header is true, the second array takes this header; if false, the YAP system automatically adds headers into both arrays.

Default parameter: True.

multiple

Boolean

No

If processing must generate several CSV files in the field. Default parameter: False.

Data input

Example of data input entered in field:

Mode 1 (Array)
Mode 2 (Array of object)
Mode 2 (fields and Data)
Mode 1 (Array)
// Two-line, comma-delimited file
const data = [
["1-1", "1-2", "1-3"],
["2-1", "2-2", "2-3"]
];
Mode 2 (Array of object)
// With implicit header row
// (keys of first object populate header row)
const data = [
{
"Column 1": "foo",
"Column 2": "bar"
},
{
"Column 1": "abc",
"Column 2": "def"
}
];
Mode 2 (fields and Data)
// Specifying fields and data explicitly
const data = {
"fields": ["Column 1", "Column 2"],
"data": [
["foo", "bar"],
["abc", "def"]
]
};

Data output

Example of data stored in data processing pipeline:

Single csv file
Multiple csv files
Single csv file
// For one csv file processing
{
"#csv": {
"key": "1233774C-D28C-479D-9CE7-12E4F8A7361A-2019062708393434.csv",
"ETag": "\"c1ba1b0640a6f6489ae213a5e116\"",
"name": "Transactions-3last",
"urlTmp": "https://storage.youngapp.co/1233774C-D28C-479D-9CE7-12E4F361A-2019062708393434.csv",
"fileName": "data.csv",
"extension": "csv",
"subDirectory": "0612900020312808"
}
}
Multiple csv files
// For multiple csv file processing. the files is stored in array
{
"#csv": [{
"key": "1233774C-D28C-479D-9CE7-12E4F8A7361A-2019062708393434.csv",
"ETag": "\"c1ba1b0640a6f6489ae213a5e116\"",
"name": "Transactions-3last",
"urlTmp": "https://storage.youngapp.co/1233774C-D28C-479D-9CE7-12E4F361A-2019062708393434.csv",
"fileName": "data.csv",
"extension": "csv",
"subDirectory": "0612900020312808"
}]
}

Read CSV file

Delimited data can be parsed from strings or files.

Data input

Name

Type

Required

Description

field

Object

Yes

Select field to read CSV

variable

String

Yes

Variable for stored data

mode

Number

Yes

Type of structure data

Data output

Mode 1 (Array)
Mode 2 (Array of object)
Mode 2 (fields and Data)
Mode 1 (Array)
// Two-line, comma-delimited file
{
"data": [
["1-1", "1-2", "1-3"],
["2-1", "2-2", "2-3"]
]
};
Mode 2 (Array of object)
// With implicit header row
// (keys of first object populate header row)
{
"data": [
{
"Column 1": "foo",
"Column 2": "bar"
},
{
"Column 1": "abc",
"Column 2": "def"
}
]
};
Mode 2 (fields and Data)
// Specifying fields and data explicitly
{
"data": {
"fields": ["Column 1", "Column 2"],
"data": [
["foo", "bar"],
["abc", "def"]
]
}
};

Setup requirements

Before setup, please check that you have granted to YAP the permission to send notification to your CSV account. For this, sign in to CSV and authorize the permissions requested by YAP.

Questions? We're always happy to help with any issues you might have! Send us an email to support@youngapp.co or request the demo with our sales team!