簡體   English   中英

在Google電子表格中插入行

[英]Insert rows into google spreadsheet

我需要在Google電子表格中插入行。 下面是我正在使用但無法插入行的代碼。 沒有構建問題。 編譯成功。

 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);
        }
    }

我已經花了很多時間來解決這個問題,但是沒有運氣。 我收到“執行身份驗證請求返回了意外結果:404”錯誤。 請幫忙。

您正在使用OAuth1.0嗎? 根據2015年5月提交的票證 ,OAuth1.0現在(自2015年5月起)已棄用,應遷移到OAuth2.0使用。 似乎返回了您遇到的相同錯誤消息。

有關OAuth2.0使用情況的更多信息,請參見開發人員頁面

希望這可以幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM