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)
1
// Two-line, comma-delimited file
2
const data = [
3
["1-1", "1-2", "1-3"],
4
["2-1", "2-2", "2-3"]
5
];
Copied!
1
// With implicit header row
2
// (keys of first object populate header row)
3
const data = [
4
{
5
"Column 1": "foo",
6
"Column 2": "bar"
7
},
8
{
9
"Column 1": "abc",
10
"Column 2": "def"
11
}
12
];
Copied!
1
// Specifying fields and data explicitly
2
const data = {
3
"fields": ["Column 1", "Column 2"],
4
"data": [
5
["foo", "bar"],
6
["abc", "def"]
7
]
8
};
Copied!

Data output

Example of data stored in data processing pipeline:
Single csv file
Multiple csv files
1
// For one csv file processing
2
{
3
"#csv": {
4
"key": "1233774C-D28C-479D-9CE7-12E4F8A7361A-2019062708393434.csv",
5
"ETag": "\"c1ba1b0640a6f6489ae213a5e116\"",
6
"name": "Transactions-3last",
7
"urlTmp": "https://storage.youngapp.co/1233774C-D28C-479D-9CE7-12E4F361A-2019062708393434.csv",
8
"fileName": "data.csv",
9
"extension": "csv",
10
"subDirectory": "0612900020312808"
11
}
12
}
Copied!
1
// For multiple csv file processing. the files is stored in array
2
{
3
"#csv": [{
4
"key": "1233774C-D28C-479D-9CE7-12E4F8A7361A-2019062708393434.csv",
5
"ETag": "\"c1ba1b0640a6f6489ae213a5e116\"",
6
"name": "Transactions-3last",
7
"urlTmp": "https://storage.youngapp.co/1233774C-D28C-479D-9CE7-12E4F361A-2019062708393434.csv",
8
"fileName": "data.csv",
9
"extension": "csv",
10
"subDirectory": "0612900020312808"
11
}]
12
}
Copied!

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)
1
// Two-line, comma-delimited file
2
{
3
"data": [
4
["1-1", "1-2", "1-3"],
5
["2-1", "2-2", "2-3"]
6
]
7
};
Copied!
1
// With implicit header row
2
// (keys of first object populate header row)
3
{
4
"data": [
5
{
6
"Column 1": "foo",
7
"Column 2": "bar"
8
},
9
{
10
"Column 1": "abc",
11
"Column 2": "def"
12
}
13
]
14
};
Copied!
1
// Specifying fields and data explicitly
2
{
3
"data": {
4
"fields": ["Column 1", "Column 2"],
5
"data": [
6
["foo", "bar"],
7
["abc", "def"]
8
]
9
}
10
};
Copied!

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 [email protected] or request the demo with our sales team!
Last modified 1yr ago