Generate CSV
Use this function to export structured tabular data into a CSV file.
The generated file is uploaded to S3 and can be downloaded or referenced using the returned file ID.
Usage
const csvGenerated = await generateCSV(payload);Payload Structure
The payload object must follow this structure:
{
title: "title-of-the-csv-file", // Required
tableName: "name-of-table", // Required
columnName: "name-of-the-column", // Optional
rows: [
{
columnName1: "columnValue1",
columnName2: "columnValue2",
columnName3: "columnValue3"
}
]
}Parameter Details
title (Required)
Name of the CSV file.
This value is used when generating the file name.
tableName (Required)
Name of the table associated with the exported data.
columnName (Optional)
Specific column reference, if required by your implementation.
rows (Required)
Array of objects representing table rows.
Each object becomes one row in the generated CSV file.
Return Value
Returns a list of generated CSV file names uploaded to S3.
Sample Output
{
fileIds: [
"table_name_Name of the CSV file_2025-06-12_vGGfWhHwb3.csv"
]
}Example Implementation
async function customizeERP(userData, apiOperations) {
if (userData && userData.length > 0) {
const csvPayload = {
title: "Name of the CSV file",
tableName: "table_name",
rows: userData
};
const csvResult = await generateCSV(csvPayload);
return {
result: csvResult
};
}
}Example Input
[
{
"name": "John Doe",
"title": "The Great Book"
},
{
"name": "Jane Smith",
"title": "Learning JavaScript"
}
]Example Output
{
"response": {
"__d3__result": {
"result": {
"response": {
"fileIds": [
"table_name_Name of the CSV file_2025-06-12_vGGfWhHwb3.csv"
]
},
"__d3__success": true,
"time": 1749719785038,
"status": 200
}
},
"__d3__error": false,
"printConsole": []
}
}