Guide
Importing data
Synchronous, batched and job-based imports, with the limits and response shapes for each.
Three modes, chosen by file size and whether you need to wait for the result.
| Mode | File size | Blocking | Use when |
|---|---|---|---|
| Synchronous | up to 20 MB | Yes | Small files where you want the row counts immediately. |
| Batched | any | Yes | Large CSV files; the SDK splits and uploads them for you. |
| Asynchronous job | any | No | Large files where you want to poll for completion. |
Synchronous import#
IBulkAPI bulk = ac.GetBulkInstance(orgId, workspaceId);
JsonElement response = bulk.ImportData(
viewId,
"TRUNCATEADD",
"csv",
true,
@"C:\data\Sales.csv",
null);
Console.WriteLine(response);Import types#
| Value | Behaviour |
|---|---|
APPEND | Add every row. Duplicates are kept. |
TRUNCATEADD | Delete all existing rows, then add. |
UPDATEADD | Update rows matching the configured key, add the rest. |
Sample response#
{
"status": "success",
"summary": "Import data",
"data": {
"importSummary": {
"totalColumnCount": 8,
"selectedColumnCount": 8,
"totalRowCount": 12500,
"successRowCount": 12498,
"warnings": 2,
"importOperation": "updateadd"
},
"importErrors": "2 rows were skipped: date value did not match the column format."
}
}Batched import#
For files over 20 MB. The SDK splits the file, uploads each batch, and returns a job id.
IBulkAPI bulk = ac.GetBulkInstance(orgId, workspaceId);
long jobId = bulk.ImportDataAsBatches(
viewId, "APPEND", true, @"C:\data\large-sales.csv", 100000, null, null);
Console.WriteLine(bulk.GetImportJobDetails(jobId));Batch size is counted in rows. Keep each resulting batch under 100 MB.
Sample job response#
{
"status": "success",
"summary": "Get import job details",
"data": {
"jobId": "35130000001343088",
"jobStatus": "JOB COMPLETED",
"importSummary": {
"totalRowCount": 2400000,
"successRowCount": 2400000,
"warnings": 0
}
}
}jobStatus is one of JOB NOT STARTED, JOB IN PROGRESS, JOB COMPLETED or JOB FAILED.
Related#
- Exporting data
- Limits — file size ceilings and API unit costs.
- Errors