4

i am using google docs spreadsheet API for .net and i want to insert new row the google docs using asp.net C# i am unable to that.

Any one can help me??

Mihir
  • 128
  • 1
  • 6
  • 1
    You should show the code that you are using now - provide some details and any error messages. Otherwise it will be very hard to help you. – Pleun Apr 06 '11 at 07:09

1 Answers1

2

If you do post what code you have already then we may be able to specifically help you.

According to the Google Developer's Guide (here):

Add a row

To insert a new row in a list-based feed, first construct a new ListEntry and set its Elements property to contain the cells in the row. For example, given the ListEntry that represents an existing row, you might prompt the user for the values of each column as follows:

ListEntry newRow = new ListEntry();

foreach (ListEntry.Custom element in existingRow.Elements)
{
  Console.Write("Enter the value of column {0}: ", element.LocalName);
  String elementValue = Console.ReadLine();

  ListEntry.Custom curElement = new ListEntry.Custom();
  curElement.LocalName = element.LocalName;
  curElement.Value = elementValue;

  newRow.Elements.Add(curElement);
}

Then insert the new row in the ListFeed as follows:

ListEntry insertedRow = feed.Insert(newRow) as ListEntry;

Spreadsheets inserts the new row immediately after the last row that appears in the list-based feed, which is to say immediately before the first entirely blank row. This code is equivalent to sending an authenticated POST request to the URL:

https://spreadsheets.google.com/feeds/list/key/worksheetId/private/full

with the corresponding XML document in the POST body.

Thanks.

Justin Clarke
  • 602
  • 7
  • 7
  • I am trying to enter the first row, but the row being added has to match the header row (or the values of column header in a worksheet). But in whole doc. nowhere its mentioned how to add a header row? Due to which I am getting a exception 400 bad request. In google doc: row.Elements.Add(new ListEntry.Custom() { LocalName = "Name", Value = "joe" });, but how to add this localName header? – Vacca Oct 29 '12 at 10:59