The setBgColor() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set the background color of the cell of spreadsheet. In order to use this function use setPattern function.
void Format::setBgColor( $color )
Parameters: This function accepts single parameter $color which takes the value of color as string like ‘red’, ‘green’ and another method is by specifying the color value between 8 to 63.
Return Value: This function returns TRUE on success and PEAR_ERROR on failure.
This article is attributed to GeeksforGeeks.org