How to Wrap Text in a Cell in Google Sheets

Danielle Jul 09, 2026

Ever found yourself struggling to fit text into a single cell in Google Sheets? You're not alone. Google Sheets, while powerful, doesn't natively support wrapping text within a single cell. However, there's a workaround that allows you to achieve this. Let's dive into how you can wrap text in a cell in Google Sheets.

How to Wrap Text in Google Sheets
How to Wrap Text in Google Sheets

Before we begin, it's essential to understand that this method involves using data validation and a script. It might seem complex at first, but don't worry, we'll break it down into simple, manageable steps.

How to Wrap Text in Google Sheets
How to Wrap Text in Google Sheets

Understanding the Method

To wrap text in a cell, we'll use Google Apps Script to create a custom function that splits the text into multiple lines. This function will then be used in data validation to display the wrapped text in the cell.

How to Wrap Text in Google Sheets | Easy Google Sheets Tutorial
How to Wrap Text in Google Sheets | Easy Google Sheets Tutorial

This method allows you to enter long text into a cell, and it will automatically wrap the text onto multiple lines within the cell. Let's get started!

Setting Up the Custom Function

How to Wrap Text in Excel and Google Sheets
How to Wrap Text in Excel and Google Sheets

First, you need to create a custom function in Google Apps Script. Here's how:

1. Click on 'Extensions' in the menu, then 'Apps Script'.

2. Delete any existing code in the 'Code.gs' file, and paste the following:

How to Hide Overflow Text in a Cell in Excel & Google Sheets
How to Hide Overflow Text in a Cell in Excel & Google Sheets

function wrapText(text, maxLength) {
  var words = text.split(' ');
  var lines = [];
  var currentLine = '';

  for (var i = 0; i < words.length; i++) {
    if ((currentLine + words[i]).length > maxLength) {
      lines.push(currentLine);
      currentLine = '';
    }
    currentLine += words[i] + ' ';
  }

  lines.push(currentLine);
  return lines.join('\n');
}

This function takes a string of text and a maximum length for each line. It splits the text into words, then into lines, ensuring that each line is within the specified length.

Using the Custom Function in Data Validation

Now that you have the custom function, it's time to use it in data validation. Here's how:

How to wrap text in Google Sheets easily
How to wrap text in Google Sheets easily

1. Select the cell where you want to enter the wrapped text.

2. Click on 'Data' in the menu, then 'Data validation'.

Basic Formatting in Google Sheets
Basic Formatting in Google Sheets
Essential Google Sheets Text and Web Formulas for Productivity
Essential Google Sheets Text and Web Formulas for Productivity
How to change text case in Google Sheets with UPPER/ LOWER/ PROPER
How to change text case in Google Sheets with UPPER/ LOWER/ PROPER
How To Apply A Button To Clear Specific Cells In Google Sheets in 2024
How To Apply A Button To Clear Specific Cells In Google Sheets in 2024
a poster with the words stop text spelling over wrap text in excel and an arrow pointing to
a poster with the words stop text spelling over wrap text in excel and an arrow pointing to
the google sheets has hidden gems you're not using on your webpages
the google sheets has hidden gems you're not using on your webpages
How to add a Calendar into a cell in Google Sheets #googlesheets #tutorial #spreadsheet
How to add a Calendar into a cell in Google Sheets #googlesheets #tutorial #spreadsheet
a screenshot of a spreadsheet with multiple columns and numbers on the screen
a screenshot of a spreadsheet with multiple columns and numbers on the screen
Make Your Google Sheets Look Professional with Alternating Colors 🎨
Make Your Google Sheets Look Professional with Alternating Colors 🎨
🤌 3 Basic Google Sheets Tips #personalgrowth
🤌 3 Basic Google Sheets Tips #personalgrowth
How to Convert Text to Number in Excel & Google Sheets
How to Convert Text to Number in Excel & Google Sheets
How to Wrap Text in Google Docs | How to Wrap Text Around Images in Google Docs
How to Wrap Text in Google Docs | How to Wrap Text Around Images in Google Docs
Make Fonts Fun in Google Sheets
Make Fonts Fun in Google Sheets
Master the EXACT Function in Google Sheets: A Step-by-Step Guide!
Master the EXACT Function in Google Sheets: A Step-by-Step Guide!
How To Create A Circle Chart In Google Sheets
How To Create A Circle Chart In Google Sheets
3 Google Sheets Shortcuts That Save You So Much Time
3 Google Sheets Shortcuts That Save You So Much Time
Group Rows in Google Sheets for Easy Data Analysis!
Group Rows in Google Sheets for Easy Data Analysis!
Eight More Google Sheets Tips to Save You Time  – TCEA TechNotes Blog
Eight More Google Sheets Tips to Save You Time  – TCEA TechNotes Blog
How To Vlookup In Google Sheets  #googlesheets #excel #spreadsheets
How To Vlookup In Google Sheets #googlesheets #excel #spreadsheets
the words multiple forms to one google sheet in front of a green background with icons
the words multiple forms to one google sheet in front of a green background with icons

3. Under 'Criteria', select 'Custom formula is'.

4. In the 'Value' field, enter the following formula: '=wrapText(A1, 20)' (replace 'A1' with the cell containing your text, and '20' with the desired maximum length for each line).

5. Click 'Save'.

Now, whenever you enter text into the cell, it will be wrapped onto multiple lines within the cell.

Troubleshooting and Best Practices

While this method works well, you might encounter some issues. Here are a few troubleshooting tips and best practices:

1. Maximum Length: The maximum length for each line determines how many characters can fit on a single line. Adjust this value based on your cell's width and the font size.

2. Text Overflow: If the text is too long to fit within the specified maximum length, it will overflow into the next cell. To prevent this, you can use the 'Wrap text' option in the cell's formatting menu to display the overflow text in the same cell.

3. Script Errors: If you encounter script errors, double-check that you've entered the formula correctly in the data validation settings. Also, ensure that the custom function is still in the 'Code.gs' file.

4. Performance: This method might slow down your Google Sheets file if you have many cells with wrapped text. To mitigate this, consider using it sparingly or only on cells that require long text.

And there you have it! You now know how to wrap text in a cell in Google Sheets. This method might seem complex at first, but with a little practice, you'll find it's a powerful tool for displaying long text in a single cell. Happy wrapping!