Bird
Raised Fist0
Google Sheetsspreadsheet~10 mins

Borders and background colors 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 background color of cell A1 to yellow using Apps Script.

Google Sheets
SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange('A1').setBackground([1]);
Drag options to blanks, or click blank then click option'
A"yellow"
B"blue"
C"red"
D"green"
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put the color name inside quotes.
Using an invalid color name.
2fill in blank
medium

Complete the code to add a solid border around the range B2:D4.

Google Sheets
SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange('B2:D4').setBorder(true, true, true, true, false, false, [1], null);
Drag options to blanks, or click blank then click option'
A"dashed"
B"double"
C"dotted"
D"solid"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a border style that is not supported.
Passing the style in the wrong argument position.
3fill in blank
hard

Fix the error in the code to set the background color of range C3:C5 to light gray.

Google Sheets
SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange('C3:C5').setBackground([1]);
Drag options to blanks, or click blank then click option'
A"lightgray"
B"#D3D3D3"
Clightgray
D#D3D3D3
Attempts:
3 left
💡 Hint
Common Mistakes
Not putting the color code inside quotes.
Using an invalid color name.
4fill in blank
hard

Fill both blanks to add a solid blue top and bottom border to range E1:E3.

Google Sheets
SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange('E1:E3').setBorder(true, false, true, false, false, false, [1], [2]);
Drag options to blanks, or click blank then click option'
A"solid"
B"dashed"
C"red"
D"blue"
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of style and color arguments.
Using color names where style is expected.
5fill in blank
hard

Fill both blanks to set a green left and right border with a dotted border style on range F4:F6.

Google Sheets
SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange('F4:F6').setBorder(false, true, false, true, false, false, [1], [2]);
Drag options to blanks, or click blank then click option'
A"dotted"
B"green"
C"yellow"
D"solid"
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing the order of style and color arguments.
Using unsupported border styles.

Practice

(1/5)
1. What is the main purpose of adding borders to cells in Google Sheets?
easy
A. To separate and organize data visually
B. To change the font style of the text
C. To calculate sums automatically
D. To protect cells from editing

Solution

  1. Step 1: Understand the role of borders

    Borders are lines around cells that help separate and organize data visually.
  2. Step 2: Compare with other options

    Changing font style, calculating sums, or protecting cells are different features unrelated to borders.
  3. Final Answer:

    To separate and organize data visually -> Option A
  4. Quick Check:

    Borders = Organize data visually [OK]
Hint: Borders help you see data sections clearly [OK]
Common Mistakes:
  • Confusing borders with font or formula features
  • Thinking borders calculate values
  • Assuming borders protect cells
2. Which of the following is the correct way to add a background color to a cell in Google Sheets?
easy
A. Right-click the cell and select 'Insert formula'
B. Select the cell, then click the paint bucket icon and choose a color
C. Double-click the cell and type the color name
D. Use the SUM function to apply color

Solution

  1. Step 1: Identify how to add background color

    In Google Sheets, you select the cell and click the paint bucket icon on the toolbar to pick a background color.
  2. Step 2: Eliminate incorrect options

    Right-clicking for formulas, typing color names, or using SUM function do not apply background colors.
  3. Final Answer:

    Select the cell, then click the paint bucket icon and choose a color -> Option B
  4. Quick Check:

    Paint bucket icon = Add background color [OK]
Hint: Use the paint bucket icon to color cells fast [OK]
Common Mistakes:
  • Trying to type color names directly in cells
  • Confusing formulas with formatting
  • Looking for color options in the wrong menu
3. You apply a thick red border to cells A1 to A3 and a light blue background color to cells A2 and A3. What will cell A2 look like?
medium
A. It has a thick red border and a light blue background
B. It has no border and no background color
C. It has a thick red border but no background color
D. It has a light blue background but no border

Solution

  1. Step 1: Understand border application

    Cells A1 to A3 have a thick red border, so A2 has this border.
  2. Step 2: Understand background color application

    Cells A2 and A3 have a light blue background, so A2 also has this background color.
  3. Final Answer:

    It has a thick red border and a light blue background -> Option A
  4. Quick Check:

    Border + background color = thick red border + light blue background [OK]
Hint: Borders and backgrounds can combine on the same cell [OK]
Common Mistakes:
  • Assuming background color overrides borders
  • Thinking borders apply only to one cell
  • Ignoring overlapping formatting
4. You want to remove all borders from cells B1 to B4 but accidentally only remove the outer borders. What is the likely cause?
medium
A. You deleted the cell contents instead of formatting
B. You applied a background color instead of removing borders
C. You selected 'Clear borders' but only chose outer borders option
D. You used the paint bucket icon instead of border options

Solution

  1. Step 1: Identify border removal method

    Removing borders requires selecting all borders or 'Clear borders' fully, not just outer borders.
  2. Step 2: Understand partial removal effect

    If only outer borders are removed, inner borders remain, causing incomplete removal.
  3. Final Answer:

    You selected 'Clear borders' but only chose outer borders option -> Option C
  4. Quick Check:

    Partial border removal = only outer borders cleared [OK]
Hint: Choose 'Clear all borders' to remove every border [OK]
Common Mistakes:
  • Confusing background color with border removal
  • Deleting data instead of formatting
  • Using paint bucket icon for borders
5. You want to highlight a group of cells from C1 to C5 with a yellow background and add a thick green border only around the entire group (not between cells). Which steps should you follow?
hard
A. Select C1:C5, apply thick green border to inner borders only, then yellow background to all
B. Select C1:C5, apply thick green border to all cells, then add yellow background to C1 only
C. Select C1:C5, apply yellow background to C1 only, then thick green border to each cell
D. Select C1:C5, apply yellow background, then choose thick green border 'Outer border' only

Solution

  1. Step 1: Apply background color to the group

    Select cells C1 to C5 and apply yellow background to all selected cells.
  2. Step 2: Add thick green border only around the group

    Choose the thick green border style and apply it as 'Outer border' so it surrounds the entire group without inner lines.
  3. Final Answer:

    Select C1:C5, apply yellow background, then choose thick green border 'Outer border' only -> Option D
  4. Quick Check:

    Outer border + full background = highlight group clearly [OK]
Hint: Use 'Outer border' to frame a cell group cleanly [OK]
Common Mistakes:
  • Applying borders to each cell instead of outer border
  • Adding background to only one cell
  • Using inner borders instead of outer border
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