Bonjour,

Voici 3 semaines que je cherche partout comment lire un Google sheet sous VB.NET, et je me tourne vers vous. (j'ai créé beaucoup perso d'appli grâce a vous, sans poser aucune question, mais la, je sèche)

Pour débuter dans le domaine des API, je veux juste afficher dans un Texbox, la valeur de la cellule A2 de mon sheet qui se nomme "sheetapi"


voici le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Imports System.IO
Imports System.Threading
Imports Google.Apis.Auth.OAuth2
Imports Google.Apis.Services
Imports Google.Apis.Sheets.v4
Imports Google.Apis.Sheets.v4.Data
Imports Google.Apis.Util.Store
 
Public Class Form1
    Shared Scopes As String() = {SheetsService.Scope.SpreadsheetsReadonly}
    Shared ApplicationName As String = "Google Sheets API .NET Quickstart"
    Public service As SheetsService = New SheetsService
 
 
 
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
 
        Dim credential As UserCredential
        Using stream = New FileStream("client_secret.json", FileMode.Open, FileAccess.Read)
            Dim credPath As String = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal)
            credPath = Path.Combine(credPath, ".credentials/sheets.googleapis.com-dotnet-quickstart.json")
 
            credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.FromStream(stream).Secrets, Scopes, "user", CancellationToken.None, New FileDataStore(credPath, True)).Result
            Console.WriteLine(Convert.ToString("Credential file saved to: ") & credPath)
        End Using
 
        Dim service = New SheetsService(New BaseClientService.Initializer() With {.HttpClientInitializer = credential, .ApplicationName = ApplicationName})
        Dim spreadsheetId As [String] = "sheetapi"
 
        Dim range As [String] = "A2"
 
        Dim request As SpreadsheetsResource.ValuesResource.GetRequest = service.Spreadsheets.Values.[Get](spreadsheetId, range)
        Dim response As ValueRange = request.Execute
        Dim values As IList(Of IList(Of [Object])) = response.Values
        TextBox1.Text = response.Values
 
 
    End Sub
 
 
End Class


A la ligne 33 Dim response As ValueRange = request.Execute j'ai l'erreur
Google.GoogleApiException*: 'The service sheets has thrown an exception. HttpStatusCode is NotFound. Requested entity was not found.'
Si quelque a une idée ... MERCI