Last active
November 8, 2022 09:54
-
-
Save cp-sumi-k/911ba6fe6c78be75c04bf10c630c94c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func prepareCells(records []string) []*sheets.RowData { | |
// init cells array | |
cells := []*sheets.CellData{} | |
bgWhite := &sheets.Color{ // green background | |
Alpha: 1, | |
Blue: 0, | |
Red: 0, | |
Green: 1, | |
} | |
// prepare cell for each records and append it to cells | |
for i := range records { | |
data := &sheets.CellData{ | |
UserEnteredValue: &sheets.ExtendedValue{ | |
StringValue: &(records[i]), // add value | |
}, | |
UserEnteredFormat: &sheets.CellFormat{ // add background color | |
BackgroundColor: bgWhite, | |
}, | |
} | |
cells = append(cells, data) | |
} | |
// prepare row from cells | |
return []*sheets.RowData{ | |
{Values: cells}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment