4 min readUpdated Mar 2, 2026

writeCsv Documentation

Overview

The writeCsv function is a component of the Vantage analytics and data platform specifically designed to facilitate the process of converting a dataset into CSV format and saving it to a specified location in Google Drive. This functionality is crucial for users who need to export data for reporting, sharing, or further analysis.

Purpose

The primary purpose of the writeCsv function is to enable users to take structured dataset input, transform it into a CSV file, and write that file directly to a designated folder within Google Drive. This automation supports efficient data handling and sharing across different platforms.

Settings

The writeCsv component includes several configurable settings that control its behavior and output.

1. fileName

2. subfolder

Additional Configurations

Beyond the configurable settings, the function also internally defines a few properties:

How It Works

The writeCsv function operates asynchronously, taking three parameters: inputs, config, and context.

  1. Inputs: This function expects an array of objects as input. Each object in this array represents a data row, and the keys of the object represent the column names for the CSV.

  2. Config: The config parameter allows the customization of settings such as fileName and subfolder. The default values will be used if these are not explicitly provided.

  3. Context: This parameter is used for any additional contextual information required during the execution of the file write operation.

The function then calls the writeFileNode to handle the actual file writing process, passing the combined configuration and the provided dataset.

Expected Data

The writeCsv function expects a well-structured input array that conforms to the following definition:

Each object represents a row in the final CSV file, with keys corresponding to column headers.

Use Cases & Examples

Use Cases

  1. Data Export for Reporting: A marketing team may want to export customer data for quarterly reporting. By using writeCsv, they can create a CSV of their customer database and share it with stakeholders.

  2. Backup Data: A data analyst may need to back up datasets routinely. Using writeCsv, they can automate the export of critical project datasets to secure storage in Google Drive.

  3. Integration with Other Tools: Teams using external analytics tools might require data in CSV format to conduct further analysis. The writeCsv function enables seamless preparation and migration of data across platforms.

Example Configuration

Scenario

A company needs to export employee records for a quarterly performance review and save the file in a subfolder named "Performance Reviews".

Configuration

Sample configuration for achieving this might look like:

javascript
const inputs = [
    {"name": "Alice Johnson", "department": "HR", "performanceScore": 85},
    {"name": "Bob Lee", "department": "Finance", "performanceScore": 90}
];

const config = {
    fileName: 'Q1_Performance_Review.csv',
    subfolder: 'Performance Reviews'
};

const context = {}; // Any necessary context information

// Function Call
await writeCsvNode({ inputs, config, context });

In this example, the file Q1_Performance_Review.csv will be saved within the "Performance Reviews" subfolder on Google Drive, containing the performance data of the employees in CSV format.