# Text to Columns

A tutorial showing how to convert simple text or sentences into separate columns in the SpreadJS Designer Component with UI

## Content

Text to Columns is used to convert simple text or sentences having multiple words into separate columns. It enables us to get the tabular structure of data using a suitable delimiter or column width option.

SpreadJS Designer provides the **Text to Columns** ribbon button in the "Data Tools" group of the "Data" tab.

# Steps to Convert Text to Columns

## Using Delimiters

This method splits the text using the present delimiter in a cell or range. You can define your delimiter as well. Only one character is considered a delimiter.

Follow the steps below to convert the sample text "a,b,c,d" using the comma delimiter.

1. Select a cell or rows of cells where you would convert the text into columns.
<br>
    ![1.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/1.af34aa.png?width=250&verticalAlign=middle)
2. Click on the "Data" tab to select the **"Text to Columns"** ribbon button from the "Data Tools" group.
<br>
    ![2.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/2.1af47f.png?width=800&verticalAlign=middle)
<br>
    The "Convert Text to Columns Wizard" window opens up.
3. Select the **Delimited** option from the "Original data type" section as shown in the below image.
<br>
    ![3.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/3.28dff3.png?width=500&verticalAlign=middle)
<br>
    Click on Next to open the "Convert Text to Columns Wizard- Step 2 of 3" window.
4. Select the delimiter from the pre-defined list of delimiters or you can enter your delimiter by specifying the desired character in the "Other" option.
<br>
    ![4.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/4.3f44e7.png?width=500&verticalAlign=middle)

    > The delimiter in the **""** or **''** will be ignored.
    > 
    > Check **"Treat consecutive delimiters as one"** option to allow if multiple characters **";;;;"** are specified, they will be treated as one **";"** only.
5. Click on Next to open the "Convert Text to Columns wizard-Step 3 of 3" window. Now, set the Data format for each column.
<br>
    You can select the destination for the text. The default destination is the original cell.
<br>
    ![5.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/5.18b164.png?width=500&verticalAlign=middle)
6. Click on Finish to convert the text of the cell into columns.
<br>
    ![6.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/6.17ba43.png?width=500&verticalAlign=middle)

## Using Fixed Widths

This method splits the text using a fixed width between the text. You can set column breaks to separate the text into columns.

1. Select a cell or rows of cells where you want to convert the text into columns.
    ![7.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/7.38d1e5.png?width=300&verticalAlign=middle)
<br>
2. Click on the "Data" tab to select the **"Text to Columns"** ribbon button from the "Data Tools" group.
<br>
    ![2.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/2.0fa5cd.png?width=800&verticalAlign=middle)
3. "Convert Text to Columns wizard- Step 1 of 3" window opens. Select **Fixed width** option from the "Original data type" section as shown below image.
<br>
    ![9.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/9.0add27.png?width=500&verticalAlign=middle)
<br>
    Click on Next to open the "Convert Text to Columns Wizard- Step 2 of 3" window.
4. Create fixed-width column breaks using the instructions mentioned on the window.
<br>
    ![10.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/10.30fd63.png?width=500&verticalAlign=middle)
<br>
    Click on Next to open the "Convert Text to Columns wizard-Step 3 of 3" window.
5. Set the Data format for each column.
<br>
    You can select the destination for the text. The default destination is the original cell.
<br>
    ![11.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/11.b6f6a4.png?width=500&verticalAlign=middle)
6. Click on Finish to convert the text of the cell into columns.
<br>
    ![12.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/12.0d99a2.png?width=500&verticalAlign=middle)

## Invalid Selections

1. If the selected cell or range of cells has no data, the following warning message appears.
<br>
    ![13.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/13.8ef06c.png?width=400&verticalAlign=middle)
2. If multiple ranges of cells or columns are selected, the following warning message appears.
<br>
    ![14.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/14.eed85d.png?width=400&verticalAlign=middle)
3. If the destination column already includes data, the following warning message appears.
<br>
    ![15.png](https://cdn.mescius.io/document-site-files/images/7719ad0a-f083-46d7-aff6-f63e2e187c15/15.6a55d7.png?width=400&verticalAlign=middle)