Supista
Contact Us
documentation
Supista ERP
Parameters
API Operations
CSV Upload

CSV Upload

CSV Upload in Supista ERP is a bulk data ingestion mechanism that allows users to upload tabular data (CSV/Excel) through the UI.

Supista does not pass raw CSV text to custom code.
Instead, the uploaded file is parsed into structured JSON and injected into the customization layer under a reserved key:

{
  "__d3__csvData": [ ... ]
}

How It Works

Each object inside __d3__csvData represents one row from the uploaded CSV file:

  • CSV headers → become object keys
  • CSV cell values → become object values
  • Empty cells → converted to null
  • Row order → preserved (important for error reporting)

Accessing CSV Data

Inside your customization function:

const csvData = userData?.__d3__csvData || [];

You can then transform these rows into a database-ready payload.


Example Implementation (Bulk Upsert)

async function customizeERP(userData, apiOperations) {
 
  const tableName = "employees";
  const { bulkCreateOp } = apiOperations;
 
  const csvData = userData?.__d3__csvData || [];
 
  // Map CSV rows directly to DB payload
  const bulkPayload = csvData.map(row => ({
    "Employees ID": row["Employees ID"],
    "Candidate_Name": row.Candidate_Name,
    "Email": row.Email,
    "Phone": row.Phone,
    "Date": row.Date
  }));
 
  // Perform Bulk UPSERT
  await bulkCreateOp(tableName, {
    __d3__bulkData: bulkPayload,
    __d3__updateOnDuplicate: true,
    __d3__conflictFields: ["Employees ID"]
  });
 
  return {
    result: {
      processed: bulkPayload.length
    },
    popupMsg: {
      type: "message",
      message: "CSV bulk upsert completed successfully."
    }
  };
}

Example Input

{
  "__d3__csvData": [
    {
      "Employees ID": 1,
      "Candidate_Name": "Mahender Singh",
      "Email": "wasamo3586@gavrom.com",
      "Phone": 7436452745
    }
  ]
}

Example Output (Error Format)

If validation or relational issues occur, structured row-level errors may be returned:

[
  {
    "Row Index": 223,
    "Error Type": "Upload Error",
    "Reason": "not_found",
    "Column Name": "3i736r6l16.Material Code",
    "Column Value": "RMBO174"
  }
]

This structure helps identify exactly which row and column caused the issue during processing.

Transform Data into Decisions with Supista – Your Intelligent Data Partner
AI-Powered Operational Intelligence for Growing Businesses

Automate your operations. Orchestrate your workflows. Scale with confidence.

Book a free strategy session with our Automation Experts and discover how Supista’s AI-Composable ERP can transform your operations into a scalable and intelligent system.