hello,
OK the solution is:
CellQuery cellQuery = new CellQuery(worksheet.CellFeedLink);
CellFeed cellFeed = _SpService.Query(cellQuery);
CellEntry cellEntry = new CellEntry(1, 1, "Number");
cellFeed.Insert(cellEntry);
cellEntry = new CellEntry(1, 2, "Migrationinfo");
cellFeed.Insert(cellEntry);
cellEntry = new CellEntry(1, 3, "Comments");
cellFeed.Insert(cellEntry);
And after the rows can be added as given in doc.
Thankx.
On Monday, October 29, 2012 6:20:55 PM UTC+1, Mandar wrote:
>
> Hello,
> Thank you for your response.
> But I don't get my answer "In your case, you want to insert entries into
> the feed which specify values for the cells 'R1C1', 'R1C2', 'R1C3', etc"
> but how to??
> All I want to do is:
> 1. Create a worksheet
> 2. Add a worksheet
> 3. Add a header row
> 4. Populate with values i.e remaining data rows
>
> Thats it!!
>
> On Monday, October 29, 2012 6:05:59 PM UTC+1, David Bullock wrote:
>>
>> Hi Mandar,
>>
>> This is part of the (interesting) way the spreadsheet concepts have been
>> mapped onto "feeds and entries". In the cells feed, an empty spreadsheet
>> really does have 0 cells, despite the fact that (for display purposes,
>> mainly) the worksheet feels that it has a height and width. You've got to
>> 'insert' entries into the feed which represent cells.
>>
>> In your case, you want to insert entries into the feed which specify
>> values for the cells 'R1C1', 'R1C2', 'R1C3', etc. Once you've done this,
>> you'll be able to use the 'List' feed. The List feed assumes that whatever
>> values appear in the first row (the 'header row') of the spreadsheet are
>> 'column names'. When you use the List feed to append rows, you'll
>> implicitly generate entries in the Cell feed.
>>
>> I hope that helps. You might be interested in the links to the old
>> 'Protocol Reference' in this issue raised prospectively on your behalf some
>> months ago
>> http://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3075&q=label%3AAPI-Spreadsheets&colspec=API%20ID%20Type%20Status%20Priority%20Stars%20Opened%20Summary
>> (please
>> vote for the issue if you find that old doc useful, thanks). At the end of
>> the day, understanding what's going on at the ATOM/REST/XML level is the
>> only key to insight.
>>
>> cheers,
>> David.
>>
>>
>>
>>
>> On Tue, Oct 30, 2012 at 1:17 AM, Mandar <[email protected]> wrote:
>>
>>> Hello,
>>> Even if I try to use Cell based feed and add this code:
>>> // Fetch the cell feed of the worksheet.
>>>
>>> CellQuery cellQuery = new CellQuery(worksheet.CellFeedLink);
>>>
>>>
>>> CellFeed cellFeed = service.Query(cellQuery);
>>>
>>>
>>> // Iterate through each cell, updating its value if necessary.
>>>
>>>
>>> foreach (CellEntry cell in cellFeed.Entries)
>>>
>>>
>>> {
>>> if (cell.Title.Text == "A1")
>>>
>>>
>>> {
>>> cell.InputValue = "200";
>>>
>>>
>>> cell.Update();
>>>
>>>
>>> }
>>> else if (cell.Title.Text == "B1")
>>>
>>>
>>> {
>>> cell.InputValue = "=SUM(A1, 200)";
>>>
>>>
>>> cell.Update();
>>>
>>>
>>> }
>>> }
>>>
>>> I get the count of cellFeed.Entries as 0, so the control never
>>> enters the foreach loop to update (i.e add) cell values at locations A1,B1
>>> and so on.
>>> As mentioned before,I have already added rows and columns into the
>>> worksheet.
>>> Again big question how do I add a simple header row values at
>>> position A1,B1,C1,D1. Why it is so unclear in the programmer's mind that if
>>> a application is build using this API, everything will be via code.
>>> I wait (desperately) for your next explanation on my above problem!!
>>>
>>> Thankx in advance.
>>>
>>>
>>> On Thursday, October 25, 2012 6:16:58 PM UTC+2, Claudio Cherubino wrote:
>>>
>>>> When working with the list-based feed, the assumption is that the
>>>> header row is already created. If you need to do everything from the
>>>> script, including the spreadsheet creation, you should probably use the
>>>> cell-based feed instead:
>>>>
>>>> https://developers.google.com/**google-apps/spreadsheets/#**
>>>> working_with_cell-based_feeds<https://developers.google.com/google-apps/spreadsheets/#working_with_cell-based_feeds>
>>>>
>>>> Claudio
>>>>
>>>>
>>>> On Thu, Oct 25, 2012 at 3:11 AM, Mandar <[email protected]> wrote:
>>>>
>>>>> Hello,
>>>>> Thank you for your reply.
>>>>> As per your post, I modified the structure of
>>>>> my spreadsheet's worksheet while its creation. But, I still get the same
>>>>> error.
>>>>> Perhaps, if I manually add the header row and then add the row (as
>>>>> provided in the documentation), then it is adding the row successfully;
>>>>> But this is completely buggy, as I cannot manually insert a header
>>>>> row after I create a worksheet. In programming terms the flow should be
>>>>>
>>>>> 1. Creating a spreadsheet
>>>>> 2. Adding a worksheet
>>>>> 3. Adding a row to worksheet
>>>>>
>>>>> I cannot add a header column in between manually!!!
>>>>>
>>>>> Kindly specify if I am doing something wrong or that is the way the
>>>>> API is build?
>>>>>
>>>>> Thankx in Advance!!
>>>>>
>>>>> On Wednesday, October 24, 2012 8:37:34 PM UTC+2, Claudio Cherubino
>>>>> wrote:
>>>>>>
>>>>>> As reported in the documentation, the list feed makes some
>>>>>> assumptions about how the data is laid out in the spreadsheet. In
>>>>>> particular, the list feed treats the first row of the worksheet as a
>>>>>> header
>>>>>> row:
>>>>>>
>>>>>> https://developers.google.com/****google-apps/spreadsheets/#**work**
>>>>>> ing_with_list-based_feeds<https://developers.google.com/google-apps/spreadsheets/#working_with_list-based_feeds>
>>>>>>
>>>>>> In your code you are trying to add a row with four values: firstname,
>>>>>> lastname, age and height. If the first row of the worksheet doesn't
>>>>>> define
>>>>>> those headers, your request will be invalid and your code throw an
>>>>>> exception.
>>>>>>
>>>>>> Please make sure that your code matches the structure of the
>>>>>> spreadsheet or use the Cell feed if you need to dynamically determine
>>>>>> the
>>>>>> contents of the header row.
>>>>>>
>>>>>> On Wednesday, October 24, 2012 8:27:56 AM UTC-7, Mandar wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>> Is this forum alive? I am continuing to get 400 response error for
>>>>>>> adding a row via google spreadsheet api and their isn't any support
>>>>>>> from on
>>>>>>> this from google admins. Is this API a release version or in alpha
>>>>>>> phase.
>>>>>>> We are using this api for commercial purposes so answer is
>>>>>>> expected after similar posts (of error messages) from other users as
>>>>>>> well.
>>>>>>>
>>>>>>> Thankx in advance.
>>>>>>>
>>>>>>>
>>>>>>> Le mercredi 24 octobre 2012 12:11:29 UTC+2, Mandar a écrit :
>>>>>>>>
>>>>>>>> Hello All,
>>>>>>>> I am new to this forum.
>>>>>>>> I am recently using Google spreadsheet API **f**or creating
>>>>>>>> spreadsheets and store data on them.
>>>>>>>> I have followed the entire tut with specifying oAuth scopes and
>>>>>>>> enabling drive sdk.
>>>>>>>> I am successfully able to create a spreadsheet and add a
>>>>>>>> worksheet too, but when I try to add a new row its gives me a
>>>>>>>> exception : {"The
>>>>>>>> remote server returned an error: (400) Bad Request."}
>>>>>>>> Moreover, I am also able to delete and update a row if I add one
>>>>>>>> manually on the spreadsheets, so I don't understand what is wrong
>>>>>>>> in my code (or if their is error on google server side?).
>>>>>>>> Also,the version 3 of API is just released and their isn't any
>>>>>>>> support on the bugs from Google admins/developers.
>>>>>>>>
>>>>>>>> Anyone knowing plz help!!
>>>>>>>> Thankx in advance.
>>>>>>>>
>>>>>>>
>>>>
>>