Bird
Raised Fist0
Google Sheetsspreadsheet~10 mins

Cell alignment and wrapping in Google Sheets - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the horizontal alignment of cell A1 to center.

Google Sheets
SpreadsheetApp.getActiveSheet().getRange('A1').setHorizontalAlignment([1]);
Drag options to blanks, or click blank then click option'
A"justify"
B"left"
C"right"
D"center"
Attempts:
3 left
💡 Hint
Common Mistakes
Using alignment without quotes causes errors.
Using 'centre' instead of 'center'.
Confusing horizontal with vertical alignment.
2fill in blank
medium

Complete the code to enable text wrapping in cell B2.

Google Sheets
SpreadsheetApp.getActiveSheet().getRange('B2').setWrap([1]);
Drag options to blanks, or click blank then click option'
A"wrap"
Btrue
C"true"
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Passing 'true' as a string instead of boolean true.
Passing false disables wrapping.
Using setWrapText instead of setWrap.
3fill in blank
hard

Fix the error in the code to set vertical alignment of cell C3 to bottom.

Google Sheets
SpreadsheetApp.getActiveSheet().getRange('C3').setVerticalAlignment([1]);
Drag options to blanks, or click blank then click option'
A"bottom"
B"middle"
C"top"
Dbottom
Attempts:
3 left
💡 Hint
Common Mistakes
Passing bottom without quotes causes an error.
Using 'center' instead of 'middle' for vertical alignment.
Confusing vertical and horizontal alignment methods.
4fill in blank
hard

Fill both blanks to set cell D4 text to wrap and align horizontally to right.

Google Sheets
var range = SpreadsheetApp.getActiveSheet().getRange('D4');
range.setWrap([1]);
range.setHorizontalAlignment([2]);
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
C"right"
D"left"
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings instead of booleans for setWrap.
Using 'left' instead of 'right' for horizontal alignment.
Forgetting quotes around alignment strings.
5fill in blank
hard

Fill all three blanks to set cell E5 text to wrap, vertical alignment to middle, and horizontal alignment to center.

Google Sheets
var cell = SpreadsheetApp.getActiveSheet().getRange('E5');
cell.setWrap([1]);
cell.setVerticalAlignment([2]);
cell.setHorizontalAlignment([3]);
Drag options to blanks, or click blank then click option'
Atrue
B"middle"
C"center"
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Passing alignment values without quotes.
Using false instead of true for wrapping.
Mixing up vertical and horizontal alignment values.

Practice

(1/5)
1. What does the Wrap Text feature do in Google Sheets?
easy
A. It makes the text bold and italic.
B. It centers the text horizontally in the cell.
C. It breaks long text into multiple lines inside the same cell.
D. It deletes extra spaces from the text.

Solution

  1. Step 1: Understand the purpose of Wrap Text

    Wrap Text makes long text fit inside a cell by breaking it into multiple lines.
  2. Step 2: Compare with other options

    Centering text is horizontal alignment, not wrapping. Bold/italic and deleting spaces are unrelated.
  3. Final Answer:

    It breaks long text into multiple lines inside the same cell. -> Option C
  4. Quick Check:

    Wrap Text = breaks text lines [OK]
Hint: Wrap Text breaks text lines inside one cell [OK]
Common Mistakes:
  • Confusing Wrap Text with text alignment
  • Thinking Wrap Text changes font style
  • Assuming Wrap Text deletes spaces
2. Which of these is the correct way to align text to the right in a Google Sheets cell?
easy
A. Select the cell and click the 'Align left' button.
B. Select the cell and click the 'Align right' button.
C. Select the cell and click the 'Center align' button.
D. Select the cell and click the 'Wrap Text' button.

Solution

  1. Step 1: Identify the alignment buttons

    The 'Align right' button moves text to the right side of the cell.
  2. Step 2: Eliminate other options

    'Align left' aligns left, 'Center align' centers text, 'Wrap Text' breaks lines, not alignment.
  3. Final Answer:

    Select the cell and click the 'Align right' button. -> Option B
  4. Quick Check:

    Right align = 'Align right' button [OK]
Hint: Right align uses the 'Align right' button [OK]
Common Mistakes:
  • Choosing 'Align left' instead of right
  • Confusing center alignment with right alignment
  • Using Wrap Text for alignment
3. You have a cell with the text: "This is a very long sentence that does not fit". If you enable Wrap Text and set vertical alignment to Middle, what will happen?
medium
A. The text will wrap into multiple lines and be centered vertically.
B. The text will disappear from the cell.
C. The text will stay in one line and be aligned at the bottom.
D. The text will be cut off and aligned at the top of the cell.

Solution

  1. Step 1: Understand Wrap Text effect

    Wrap Text breaks long text into multiple lines inside the cell.
  2. Step 2: Understand vertical alignment 'Middle'

    Vertical middle alignment centers the text vertically in the cell.
  3. Final Answer:

    The text will wrap into multiple lines and be centered vertically. -> Option A
  4. Quick Check:

    Wrap Text + Middle align = wrapped, vertically centered [OK]
Hint: Wrap Text + Middle vertical align centers wrapped text [OK]
Common Mistakes:
  • Thinking text stays one line with Wrap Text
  • Confusing vertical alignment with horizontal
  • Assuming text disappears when wrapped
4. A user wants to make text appear fully inside a cell without changing column width. They try to align text to the center but the text still overflows. What should they do?
medium
A. Enable Wrap Text to break the text into multiple lines inside the cell.
B. Change the font color to white.
C. Delete the text and retype it.
D. Use the 'Align left' button instead.

Solution

  1. Step 1: Identify the problem

    Text overflows because it is too long for the cell width.
  2. Step 2: Apply Wrap Text

    Wrap Text breaks the text into multiple lines so it fits inside the cell without changing width.
  3. Final Answer:

    Enable Wrap Text to break the text into multiple lines inside the cell. -> Option A
  4. Quick Check:

    Wrap Text fixes overflow without resizing [OK]
Hint: Use Wrap Text to fit long text inside cell width [OK]
Common Mistakes:
  • Changing font color does not fix overflow
  • Deleting text is unnecessary
  • Align left does not prevent overflow
5. You have a table where some cells contain long text. You want all text to be visible, aligned at the top, and wrapped inside each cell. Which combination of settings should you apply?
hard
A. Disable Wrap Text and set vertical alignment to Middle.
B. Disable Wrap Text and set vertical alignment to Top.
C. Enable Wrap Text and set vertical alignment to Bottom.
D. Enable Wrap Text and set vertical alignment to Top.

Solution

  1. Step 1: Ensure text visibility

    Enabling Wrap Text breaks long text into multiple lines so all text fits inside the cell.
  2. Step 2: Align text at the top

    Setting vertical alignment to Top places the text at the top edge of the cell for consistent appearance.
  3. Final Answer:

    Enable Wrap Text and set vertical alignment to Top. -> Option D
  4. Quick Check:

    Wrap Text + Top align = visible, top-aligned text [OK]
Hint: Wrap Text + Top vertical align shows all text at top [OK]
Common Mistakes:
  • Disabling Wrap Text hides overflow text
  • Using Bottom or Middle vertical alignment changes text position
  • Assuming alignment alone fixes visibility
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard