I am developing Xamarin.Forms application and what I am trying to do is:
Currently, I know that Google updated quite a lot their API with latest version and I no more can use SpreadsheetsService. What I see in official documentation is that they're using SheetsService, at least that's what they've here.
This is my code right now:
var service = new SheetsService(new BaseClientService.Initializer
{
HttpClientInitializer = this.userCredential,
ApplicationName = Statics.StaticStrings.AppDomain.ApplicationName
});
var spreadsheetId = "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms";
var range = "Class Data!A2:E";
SpreadsheetsResource.ValuesResource.GetRequest request = service.Spreadsheets.Values.Get(spreadsheetId, range);
So far it's working, but the problem that I have is that I can get spreadsheet if I have it's ID, but I am not sure from where I can get it and, of course I don't want to hard code it (makes no sense).
this.userCredential is field from type Google.Apis.Auth.OAuth2.UserCredential, where I pass (IAuthorizationCodeFlow flow, string userId, TokenResponse token), so after I pass token I expect that my user will be already logged in.
My question here is, how can I get all spreadsheets to which authenticated user is authorized, so I can use them after that?
Thanks in advance!
The Sheets API v4 does not provide this specific operation. Here is Why.
You can do using Google Drive API's
https://developers.google.com/drive/v3/reference/#Files https://developers.google.com/drive/v3/reference/files/list
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With