> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/sdocs/advanced-template-logic/template-attributes/template-attributes-how-to-guides/how-to-split-field-values-into-individual-cells.md).

# How To: Split Field Values into Individual Cells

Split field text into fixed-width cells for forms and character boxes.

Use `toCells` when a form needs one character per box.

### Problem

You need to display each character of a field in its own table cell.

### Solution

**Basic implementation:**

```
<table>
  <tr>
    <td>{{!Opportunity.Product_Code__c toCells="5,codeCell"}}</td>
  </tr>
</table>
```

**Input:** `ABC12`\
**Output:** `|A|B|C|1|2|`

### With Custom Styling

```
<style>
.codeCell {
  border: 1px solid #000;
  padding: 8px;
  text-align: center;
  width: 40px;
  font-family: monospace;
  font-size: 16px;
}
</style>

<table style="border-collapse: separate; border-spacing: 5px;">
  <tr>
    <td colspan="5"><strong>Enter Code:</strong></td>
  </tr>
  <tr>
    <td>{{!Opportunity.Verification_Code__c toCells="5,codeCell"}}</td>
  </tr>
</table>
```

### Practical Example: ZIP Code

```
<style>
.zipCell {
  border: 2px solid #333;
  padding: 10px;
  text-align: center;
  width: 35px;
  font-weight: bold;
  background-color: #f9f9f9;
}
</style>

<p>ZIP Code:</p>
<table style="border-collapse: collapse;">
  <tr>
    <td>{{!Account.BillingPostalCode toCells="5,zipCell"}}</td>
  </tr>
</table>
```

### Tips

* Use this inside `<td>` tags.
* The first parameter is the number of cells.
* The second parameter is the CSS class name.
* Short values leave blank cells.
* Long values are truncated.
* This is useful for postal codes, serial numbers, and verification codes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.sdocs.com/sdocs/advanced-template-logic/template-attributes/template-attributes-how-to-guides/how-to-split-field-values-into-individual-cells.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
