finding old code from 2020-10-19

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2020-10-19 12:16:08 -04:00
parent c11fd878cd
commit a971fe90c7
Signed by: vbatts
GPG key ID: 10937E57733F1362

View file

@ -89,8 +89,8 @@ func main() {
// Prints the names and majors of students in a sample spreadsheet: // Prints the names and majors of students in a sample spreadsheet:
// https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit // https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
spreadsheetId := "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms" spreadsheetId := "1gAn7JyASTCydfC2ZllUx4qpS2hMTd5TWVykq6AVAf-c"
readRange := "Class Data!A2:E" readRange := "Sheet1!A2:E"
resp, err := srv.Spreadsheets.Values.Get(spreadsheetId, readRange).Do() resp, err := srv.Spreadsheets.Values.Get(spreadsheetId, readRange).Do()
if err != nil { if err != nil {
log.Fatalf("Unable to retrieve data from sheet: %v", err) log.Fatalf("Unable to retrieve data from sheet: %v", err)
@ -102,8 +102,7 @@ func main() {
fmt.Println("Name, Major:") fmt.Println("Name, Major:")
for _, row := range resp.Values { for _, row := range resp.Values {
// Print columns A and E, which correspond to indices 0 and 4. // Print columns A and E, which correspond to indices 0 and 4.
fmt.Printf("%s, %s\n", row[0], row[4]) fmt.Printf("%q\n", row)
} }
} }
} }