Mar 19, 2014

How to insert a list (Data) in google spreadsheet in c# ?

Before coding, create uri for your spreadsheet, see below setpes:
1.login to google drive and open your spreadsheet
2.Download spreadsheet through (File -> Dowanload as -> Webpage) then new page will be oped

3. collect spreadsheet id from querystring (see below )

4. this is uri
here  t04UA4wbOY42Aeyaar7WZdQ is spreadsheet id and od6 is sheet id ( sheet id Initial from od6 (sheet1), if sheet2 then od7 )

using Google.GData.Client;
using Google.GData.Spreadsheets;

Downlaod assembly from here and add to references folder

C# Code:
//user setUserCredential
string UserId = ""; // google account userid
string Password = "xxxxxxx";   // declare password to "xxxxxxx" of your google accout password

    ListEntry entry = new ListEntry();

    ListEntry.Custom custom = new ListEntry.Custom();
    custom.LocalName = "name"// here “name” is a column name
    custom.Value = "softtech" // input your data… like softtech

    AtomEntry retEntry = service.Insert(new Uri(""), entry);
catch { }