简体   繁体   中英

Insert rows into google spreadsheet

I need to insert rows into Google spreadsheet. Below is the code which I am using but not able to insert rows. There is no build issue. Compilation was successfull.

 SpreadsheetsService GoogleExcelService =  new SpreadsheetsService("GoogleSheet");

        protected void Page_Load(object sender, EventArgs e)
        {
            //Pass Google credentials 
            GoogleExcelService.setUserCredentials("user@gmail.com", "password");

            ListEntry entry = new ListEntry();
            //Add new row data with productname bottles and quantity 100.
            entry.Elements.Add(new ListEntry.Custom() { LocalName = "productname", Value = "Bottles" });
            entry.Elements.Add(new ListEntry.Custom() { LocalName = "quantity", Value = "100" });

            //AtomEntry retEntry = GoogleExcelService.Insert(

            AtomEntry retEntry = GoogleExcelService.Insert(new Uri("***WHAT URI I SHOULD PROVIDE HERE"), entry);
        }
    }

I had already spent too much time on this to figure out the issue but no luck. I am getting the "Execution of authentication request returned unexpected result: 404" error. Please help.

Are you using OAuth1.0? Based on a ticket submitted last May 2015, OAuth1.0 is now deprecated (as of May 2015) and should be migrated to OAuth2.0 use. It seems to return the same error message you're encountering.

More information about OAuth2.0 usage can be seen on the developer page .

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM