# How to Update a HubDB table cell?

**URL:** <https://community.hubspot.com/t/how-to-update-a-hubdb-table-cell/11377>\
**Category:** APIs & Integrations\
**Created:** [February 16, 2018, 9:57pm UTC](https://community.hubspot.com/t/how-to-update-a-hubdb-table-cell/11377 "2018-02-16T21:57:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![direstardb](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/direstardb/32/99782_2.png) [@direstardb](https://community.hubspot.com/u/direstardb)\
**Post date:** [February 16, 2018, 9:57pm UTC](https://community.hubspot.com/t/how-to-update-a-hubdb-table-cell/11377/1 "2018-02-16T21:57:39Z")

</div>

Hi, I was wondering if anyone had any code to share to illustrate how to use the HubSpot API to update a cell in a HubDB table. If you could please include all of the code, not just the API call, that would be great.

I’m not too fussy about the code, but I’m more familiar with PHP.

Thank you!

---

<div class="post-metadata">

**Author:** ![danaketh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/danaketh/32/96815_2.png) [@danaketh](https://community.hubspot.com/u/danaketh)\
**Post date:** [February 16, 2018, 10:37pm UTC](https://community.hubspot.com/t/how-to-update-a-hubdb-table-cell/11377/2 "2018-02-16T22:37:05Z")

</div>

Here’s an example which should help you start. IDs for table, row and cell are taken from the API documentation example at [https://developers.hubspot.com/docs/methods/hubdb/update\_cell](https://developers.hubspot.com/docs/methods/hubdb/update_cell)

```auto
<?php

// Options
$apiKey = '<YOUR_API_KEY>';
$tableId = 300081;
$rowId = 4685456343;
$cellId = 4;

// Put the URL together
$requestUrl = sprintf(
 'https://api.hubapi.com/hubdb/api/v1/tables/%s/rows/%s/cells/%s?hapikey=%s',
 $tableId,
 $rowId,
 $cellId,
 $apiKey
);

// Prepare our data for the cell
$data = [
 'value' => 'some value'
];

// Proceed with the API call
$ch = curl_init($requestUrl);
$dataJson = json_encode($data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataJson);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
 'Content-Type: application/json',
]);
$response = curl_exec($ch);

if (!$response) {
 trigger_error(curl_error($ch));
}

curl_close($ch);

```

---

<div class="post-metadata">

**Author:** ![direstardb](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/direstardb/32/99782_2.png) [@direstardb](https://community.hubspot.com/u/direstardb)\
**Post date:** [February 19, 2018, 4:30pm UTC](https://community.hubspot.com/t/how-to-update-a-hubdb-table-cell/11377/3 "2018-02-19T16:30:33Z")

</div>

Thanks for the help!
