Redesign data model around layered Veracross import; add findsheet tool

This commit is contained in:
Ian Gulliver
2026-08-16 09:42:27 -07:00
parent 1465a4ef05
commit 77b0401a8b
3 changed files with 151 additions and 22 deletions
+34
View File
@@ -0,0 +1,34 @@
// Command findsheet lists spreadsheets visible to the service account.
package main
import (
"context"
"fmt"
"log"
"heliosian/internal/data"
"google.golang.org/api/drive/v3"
"google.golang.org/api/option"
)
func main() {
svc, err := drive.NewService(context.Background(),
option.WithCredentialsFile(data.KeyFile),
option.WithScopes(drive.DriveReadonlyScope))
if err != nil {
log.Fatalf("[ERROR] create drive client: %v", err)
}
resp, err := svc.Files.List().
Q("mimeType = 'application/vnd.google-apps.spreadsheet'").
Corpora("allDrives").
IncludeItemsFromAllDrives(true).
SupportsAllDrives(true).
Fields("files(id, name, modifiedTime, driveId)").
Do()
if err != nil {
log.Fatalf("[ERROR] list spreadsheets: %v", err)
}
for _, f := range resp.Files {
fmt.Printf("%s %s (modified %s, drive %s)\n", f.Id, f.Name, f.ModifiedTime, f.DriveId)
}
}