I want to access the data from public google docs.
https://docs.google.com/spreadsheets/d/12i3Lvwb_14fQES27jVP6baqqmWUXWwM7fZy-neDH3bE/edit#gid=0
The link is working.
The code I'm using:
package main
import (
"context"
"fmt"
"log"
"google.golang.org/api/docs/v1"
"google.golang.org/api/option"
)
var docURL = "https://docs.google.com/spreadsheets/d/12i3Lvwb_14fQES27jVP6baqqmWUXWwM7fZy-neDH3bE/edit#gid=0"
func main() {
ctx := context.Background()
srv, err := docs.NewService(ctx, option.WithoutAuthentication(), option.WithEndpoint(docURL))
if err != nil {
log.Fatalf("Unable to retrieve Docs client: %v", err)
}
// Prints the title of the requested doc:
// https://docs.google.com/spreadsheets/d/12i3Lvwb_14fQES27jVP6baqqmWUXWwM7fZy-neDH3bE/edit#gid=0
docId := "12i3Lvwb_14fQES27jVP6baqqmWUXWwM7fZy-neDH3bE"
doc, err := srv.Documents.Get(docId).Do()
if err != nil {
log.Fatalf("Unable to retrieve data from document: %v", err)
}
fmt.Printf("The title of the doc is: %s\n", doc.Title)
}
It returns 404 not found. What I'm doing wrong?