---
schema_version: "1"
id: 28a231c57ebe5809dd83aa3eaf85e5eae4041823449f15393c68b2c1ed71d8f4
title: UpsertData
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-programmatic-content/ssjs_platformDataExtensionUpsertData.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformDataExtensionUpsertData.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 078450a1f4e80af551cfa66951a6006ba32f8eed2c04df84d4ec9d8fdef2e565
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# UpsertData

Updates or inserts information into a data extension as indicated by the array containing the listed column name and value pairs. This method adds the information if the data extension does not contain an applicable value or updates the existing applicable value to the new value. You can include multiple column name and value parts in a single call. You can use this method in non-sendable contexts, such as landing pages. This call returns the number of rows modified.

## Syntax

`Platform.Function.UpsertData(1, 2, 3, 4, 5)`

## Function Properties

| Ordinal | Type   | Description                                                |
| ------- | ------ | ---------------------------------------------------------- |
| `1`     | string | Required. Name of data extension                           |
| `2`     | array  | Required. Array containing column names to filter on       |
| `3`     | array  | Array containing values to filter on                       |
| `4`     | array  | Required. Array containing column names to include updates |
| `5`     | array  | Required. Array containing column values to update         |

## Examples

```
<script runat="server">
     var rows = Platform.Function.UpsertData("CustomerData",["ID"],["12345"],["Company","Country","Region"],["exampleCompany","USA","West"]);
</script>
```
