0
votes

I'm trying to use Google.Apis.Sheets.v4 in a C# console application just to insert some rows in a sheet.

I've followed the example at official Google API Sheets site. To get informations, it works fine. But I can not put information on this sheet. I found this error all the times that I've tried:

Invalid JSON payload received. Unknown name "e_tag" at 'data': Cannot find field.

Here a part of the code that I'm using:

        /*... 
        Authentication part
        */ 
        String spreadsheetId = "SPREADSHEET_ID";
        String range = "Sheet1!A1:A250";
        SpreadsheetsResource.ValuesResource.GetRequest request =
                service.Spreadsheets.Values.Get(spreadsheetId, range);

        ValueRange response = request.Execute();
        IList<IList<Object>> values = response.Values;

        var vr = new ValueRange()
        {
            ETag = "123456",
            MajorDimension = "COLUMNS",
            Range = "Sheet1!B2:B250",
            Values = values
        };


        var request2 = service.Spreadsheets.Values.Append(vr, spreadsheetId, "Sheet1!B2:B250");
        var inseriu = request2.Execute(); // the error occurs at this point

Any ideas?

2

2 Answers

0
votes

Neither ETag, e_tag, or any variant of those are valid fields in the ValueRange class. You said you followed the instructions on the .NET Quickstart, but nothing on that pages mentions an etag. The reference docs for ValueRange also do not mention an ETag.

If you remove the etag value, things should work. (Though I'm curious why you included it in the first place. What are you trying to do?)

0
votes

The program say your json field e_tag have not find.And the json is "field":"value" I see your field is ETag not a e_tag .

You should change all your field name to be same as the json.