Error in using Google Sheets API to add value in Google Sheets

Error in using Google Sheets API to add value in Google Sheets

Hi,

I am using the following code to add values in google sheets through custom functions. I am not able to figure out correct way of adding values in the invoke uRL. Can anyone help me out.

I am attaching the code and the error message which we are getting.

info rowNum;
range = "D" + rowNum;
value = [["a","B"]];
gSheetWriteParam = Map();
gSheetWriteParam.put("valueInputOption","RAW");
gSheetWriteParam.put("data", {"values":value});
response = invokeurl
[
url :"https://sheets.googleapis.com/v4/spreadsheets/" + spreadsheetId + "/values/Data!" + range
type :PUT
parameters:gSheetWriteParam
connection:"gsheet"
];
info response;



Error Message:

{"error":{"code":400,"message":"Invalid JSON payload received. Unknown name \"data\": Cannot bind query parameter. 'data' is a message type. Parameters can only be bound to primitive types.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"description":"Invalid JSON payload received. Unknown name \"data\": Cannot bind query parameter. 'data' is a message type. Parameters can only be bound to primitive types."}]}]}}

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now