Load sheet into in-memory data model and serve it as the API

This commit is contained in:
Ian Gulliver
2026-08-15 16:22:25 -07:00
parent ba8d3d6fe4
commit 97af37ba40
10 changed files with 513 additions and 87 deletions
+10
View File
@@ -26,6 +26,7 @@ func main() {
tab := flag.String("tab", "", "print rows of this tab instead of the overview")
rows := flag.Int("rows", 0, "with -tab, print only n rows")
from := flag.Int("from", 1, "with -tab and -rows, first row to print")
cells := flag.Bool("cells", false, "with -tab, print each non-empty cell with its column index")
flag.Parse()
if *sheet == "" {
log.Fatal("[ERROR] -sheet <spreadsheet id> is required")
@@ -46,6 +47,15 @@ func main() {
log.Fatalf("[ERROR] read tab %s: %v", *tab, err)
}
for _, row := range resp.Values {
if *cells {
for i, cell := range row {
if s := fmt.Sprint(cell); s != "" {
fmt.Printf(" %d: %q\n", i, s)
}
}
fmt.Println("---")
continue
}
fmt.Println(row)
}
return