title: Not able to read spread sheet , getting error
body: <p>I am getting the error </p>
  
  <blockquote>
    <p>An unhandled exception of type 'Google.GoogleApiException' occurred in mscorlib.dll Additional information: Google.Apis.Requests.RequestError
    The caller does not have permission [403]
    Errors [    Message[The caller does not have permission] Location[ - ] Reason[forbidden] Domain[global] ]</p>
  </blockquote>
  
  <p>or </p>
  
  <blockquote>
    <p>Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. 
    See <a href="https://developers.google.com/identity/sign-in/web/devconsole-project" rel="nofollow noreferrer">https://developers.google.com/identity/sign-in/web/devconsole-project</a>. [401]</p>
  </blockquote>
  
  <p>please let me know what i need to edit  </p>
  
  <pre><code>string AccountFilePath = @"C:\GFApps\My App\Google Service\ServiceAccount\Json\CREG Service-427e7b31069c.json";
  string AccountEmail = "cregadmin@creg-service.iam.gserviceaccount.com";
  string AccountAdminUser = "googleIntegration.NET@domain.com";
  string UserToImpersonate = null;
  
  ServiceAccountCredential credential;
  var credentialParameters = NewtonsoftJsonSerializer.Instance.Deserialize&lt;JsonCredentialParameters&gt;(File.ReadAllText(AccountFilePath));
  
  using (var stream = new FileStream(AccountFilePath, FileMode.Open, FileAccess.Read)) {
      credential = ServiceAccountCredential.FromServiceAccountData(stream);
  }
  
  
  var credentialforuser = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(AccountEmail) {
      Scopes = Scopes,
      User = string.IsNullOrEmpty(UserToImpersonate) ? AccountAdminUser : UserToImpersonate,
      Key = credential.Key
  } .FromPrivateKey(credentialParameters.PrivateKey));
  
  Console.WriteLine("read from spread sheet ");
  
  // Create Google Sheets API service.
  var service = new SheetsService(new BaseClientService.Initializer() {
      HttpClientInitializer = credentialforuser,
      ApplicationName = ApplicationName,
  });
  
  // Define request parameters.
  String spreadsheetId = "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms";
  // String spreadsheetId = "1nWdSM90mG7qT8YcOucHc_3NdmLYLpZd3FPJOF4lXMhY";
  String range = "Class Data!A2:E";
  SpreadsheetsResource.ValuesResource.GetRequest request =
      service.Spreadsheets.Values.Get(spreadsheetId, range);
  
  // Prints the names and majors of students in a sample spreadsheet:
  // https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
  
  ValueRange response = request.Execute();
  IList&lt;IList&lt;Object&gt;&gt; values = response.Values;
  if (values != null &amp;&amp; values.Count &gt; 0) {
      Console.WriteLine("Name, Major");
      foreach (var row in values) {
          // Print columns A and E, which correspond to indices 0 and 4.
          Console.WriteLine("{0}, {1}", row[0], row[4]);
      }
  } else {
      Console.WriteLine("No data found.");
  }
  </code></pre>