Matthew Trip
Matthew Trip

Reputation: 370

Spreadsheets.Get() Request Always Returns 500

var request = service
    .Spreadsheets
    .Values
    .Get(spreadsheetId, "Archive");

This method returns a List<List<object>> that contains the cell contents. It's much more limited though, as I would like to access the CellData object. This can retrieved by following instead.

var request = service
    .Spreadsheets
    .Get(spreadsheetId);

This method returns the whole spreadsheet and gives much more information. However, applying this Get() method specifically ALWAYS returns

[20:18:03 ERR] Google.Apis.Requests.RequestError
Internal error encountered. [500]
Errors [
Message[Internal error encountered.] Location[ - ] Reason[backendError] Domain[global]
]

I have no idea what could be causing this and I've tried over the course of a few hours. It is the only request I am making via await request.ExecuteAsync();

Upvotes: 0

Views: 103

Answers (1)

Matthew Trip
Matthew Trip

Reputation: 370

It turns out I needed to specify the sheet ranges.

var request = service
    .Spreadsheets
    .Get(spreadsheetId);

var ranges = new[] {"Sheet1"};
request.Ranges = ranges;

And then it works.

Upvotes: 2

Related Questions