I am trying to access google sheet using a Service account in a .net core console application. I can read the google sheet from my personal account. It has no issues. But trying to access google sheet in an organizational domain, it says Don't have permission to access the sheet. I have shared the google sheet with the service account.
GoogleCredential credential;
using(var stream = new FileStream("client_secret.json",FileMode.Open,FileAccess.Read))
{
credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes);
}
service = new SheetsService(new Google.Apis.Services.BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName,
});
var range = $"{Sheet}!A:F";
var request = service.Spreadsheets.Values.Get(SpreadsheetId, range);
var response = request.Execute();
But It throws a permission error on execution. Is there any way to access using the organization domain? is it because the organization restricts users to access files from the organization's domain only