Last active
November 8, 2022 09:54
-
-
Save cp-sumi-k/c39a0c1c89f4ffe6a36f9962853ad342 to your computer and use it in GitHub Desktop.
This file contains 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
// https://docs.google.com/spreadsheets/d/<SPREADSHEETID>/edit#gid=<SHEETID> | |
sheetId := <SHEETID> | |
spreadsheetId := <SPREADSHEETID> | |
records := []string{"1", "ABC", "[email protected]"} | |
// create the batch request | |
batchUpdateRequest := sheets.BatchUpdateSpreadsheetRequest{ | |
Requests: []*sheets.Request{ | |
{ | |
AppendCells: &sheets.AppendCellsRequest{ | |
Fields: "*", // for adding data in all cells | |
Rows: prepareCells(records), // get formatted cells row | |
SheetId: int64(sheetId), // use sheetID here | |
}, | |
}, | |
}, | |
} | |
// execute the request using spreadsheetId | |
res, err := srv.Spreadsheets.BatchUpdate(spreadsheetId, &batchUpdateRequest).Context(ctx).Do() | |
if err != nil || res.HTTPStatusCode != 200 { | |
log.Error(err) | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment