---
schema_version: "1"
id: 11931d0300a73d4a03b0245257b622a68a7f4239787333abb5a3e225417e34ff
title: Add the Data
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi-dev-guide-ext-data/guides/concept/bi-ext-data-add-data.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-ext-data/guide/bi-ext-data-add-data.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 684667ae5f86f958aeeb3b07e030fa0308a4cad29675fb3b9747b84bb9b2eaee
products:
  - Analytics External Data API Developer Guide
  - analytics
---

# Add the Data

When uploading external data files, you can use the InsightsExternalDataPart object to load the data in smaller chunks.

After inserting a row into the InsightsExternalData (header) object, split your data into 10-MB chunks and upload the chunks to InsightsExternalDataPart objects. You associate the part objects with the header object by setting the InsightsExternalDataId field on the part objects to the ID of the header object. The part objects contain the bytes of data and must be assigned part numbers in a contiguous sequence, starting with 1.

Ensure that the chunks of data are smaller than 10 MB. If the data is compressed, it must be compressed first and then split into 10-MB chunks. Only the gzip format is supported.

The following example splits a file into 10-MB chunks, and then uploads the chunks to InsightsExternalDataPart objects.

```nolang
List<File> fileParts = chunkBinary(dataFile); //Split the file

for(int i = 0;i<fileParts.size();i++)
{
    SObject sobj = new SObject();
    sobj.setType("InsightsExternalDataPart");
    sobj.setField("DataFile", FileUtils.readFileToByteArray(fileParts.get(i)));
    sobj.setField("InsightsExternalDataId", parentID);
    obj.setField("PartNumber",i+1); //Part numbers should start at 1
    SaveResult[] results = partnerConnection.create(new SObject[] { sobj });
    for(SaveResult sv:results)
        if(sv.isSuccess())
            rowId = sv.getId();
}
```

For detailed information about the InsightsExternalDataPart object, see [InsightsExternalDataPart](https://developer.salesforce.com/docs/analytics/bi-dev-guide-ext-data/reference/bi-ext-data-object-externaldatapart.md).
