質問

As seen as Google Api, i can easily put my data into a spreadsheet as below :

namespace MySpreadsheetIntegration
{
  class Program
  {
    static void Main(string[] args)
    {
      SpreadsheetsService service = new SpreadsheetsService("MySpreadsheetIntegration-v1");

      // TODO: Authorize the service object for a specific user (see other sections)

      // Instantiate a SpreadsheetQuery object to retrieve spreadsheets.
      SpreadsheetQuery query = new SpreadsheetQuery();

      // Make a request to the API and get all spreadsheets.
      SpreadsheetFeed feed = service.Query(query);

      if (feed.Entries.Count == 0)
      {
        // TODO: There were no spreadsheets, act accordingly.
      }

      // TODO: Choose a spreadsheet more intelligently based on your
      // app's needs.
      SpreadsheetEntry spreadsheet = (SpreadsheetEntry)feed.Entries[0];
      Console.WriteLine(spreadsheet.Title.Text);

      // Get the first worksheet of the first spreadsheet.
      // TODO: Choose a worksheet more intelligently based on your
      // app's needs.
      WorksheetFeed wsFeed = spreadsheet.Worksheets;
      WorksheetEntry worksheet = (WorksheetEntry)wsFeed.Entries[0];

      // Define the URL to request the list feed of the worksheet.
      AtomLink listFeedLink = worksheet.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);

      // Fetch the list feed of the worksheet.
      ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString());
      ListFeed listFeed = service.Query(listQuery);

      // Create a local representation of the new row.
      ListEntry row = new ListEntry();
      row.Elements.Add(new ListEntry.Custom() { LocalName = "firstname", Value = "Joe" });
      row.Elements.Add(new ListEntry.Custom() { LocalName = "lastname", Value = "Smith" });
      row.Elements.Add(new ListEntry.Custom() { LocalName = "age", Value = "26" });
      row.Elements.Add(new ListEntry.Custom() { LocalName = "height", Value = "176" });

      // Send the new row to the API for insertion.
      service.Insert(listFeed, row);
    }
  }
}

If i wrote "firstname" into the A1 and "lastname" into the B1, this is working, but i want to start this function ie. F21.

I mean, my localname firstname is in the cell F21 and i want google api to put my data "JOE" into F22 cell and ...

How can i do that ?

Regards.

役に立ちましたか?

解決

CellFeed will do that, but list feed is more like an SQL style database table. Suggest you use CellFeed or update your data SQL style, in whole rows.

I gave up with list feed when I discovered how little control you have over the position of the data.

Good examples:

CellFeed

https://gdata-java-client.googlecode.com/svn-history/r51/trunk/java/sample/spreadsheet/cell/CellDemo.java

ListFeed

https://gdata-java-client.googlecode.com/svn-history/r51/trunk/java/sample/spreadsheet/list/ListDemo.java

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top