0

I have tried to test code to read the content of a google sheet from C#

For now, I have copied the code from: http://mscodingblog.blogspot.com.mt/2016/11/how-to-read-google-spreadsheet-using.html

Everything is verbatim, but my keyfile.

When running, I get a 403.

The account is admin, the spreadsheet is even posted publicly on the web (id: 1wAkLe8GRpsL_FrBjEi4aMTeR1wGWWllwqBdY2Z8zVms) and I request read-only access, and yet, I can't access it.

If I run it with the wrong spreadsheet Id, I get a 404, so at least I know it finds the spreadsheet in the first call.

I am using a service account.

I found this: Getting a 403 - Forbidden for Google Service Account but it doesn't really help me as there doesn't seem to be a valid solution there.

What could I be missing?

Thomas
  • 10,933
  • 14
  • 65
  • 136
  • Based from this [thread](https://www.daimto.com/google-drive-api-c/#comment-3460), 403 forbidden normally has something to do with the fact the server just doesn’t like your request I don’t think you have even gotten to the authorization part. You may also check these links: [1](https://stackoverflow.com/questions/40669248/google-net-api-fails-due-to-error-403-forbidden) and [2](https://stackoverflow.com/questions/39071385/getting-403-forbidden-when-using-the-google-sheets-api-and-a-service-account). – abielita Oct 12 '17 at 14:17

1 Answers1

0

Try deleting your .credential directory. On Windows, you would open a file explorer and navigate to .credentials.

Sero
  • 161
  • 8