0
0
Google Sheetsspreadsheet~10 mins

Cell alignment and wrapping in Google Sheets - Interactive Code Practice

Choose your learning style9 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.