Thanks for your reply.

On Wed, Mar 2, 2011 at 3:45 PM, Vic Fryzel <[email protected]> wrote:

> 2. If I have a CellFeed with all of the spreadsheet's data in it, and I
>> want to examine the contents of the cell at a specific row,column, how do I
>> do that? I can't find any way to ask for a cell by location, only to iterate
>> through all cells and test to see if the location is the one I'm looking
>> for...
>>
>
> Use the range parameter in your URL:
>
> http://code.google.com/apis/spreadsheets/data/3.0/reference.html#CellParameters
>

So I have to make a separate HTTP request for every cell I want to
examine... ?


The particular application I was writing was for processing some data in a
spreadsheet generated by Google Forms. All of the data in the spreadsheet
needed to be retrieved and processed at once (data size roughly 40 columns
by 900 rows).

Some of the columns require special processing and the user of my
application has to be able to choose which columns to treat specially, and
my application has to store that choice for future use.

Unfortunately, Google Forms uses the questions themselves as the column
headers. The questions on this form are very long and the wording on them is
frequently changed and beyond my control. Also, logically, it does not make
sense to me to have to rely on the wording of a question to identify a
column in a Google Forms spreadsheet. So, the only reliable solution was to
use the column number to identify columns.

Additionally, it's important that my application know the order of the
columns in the spreadsheet, so when it gets a row, it can display that data
to the user in the same order that it is on the form, among other things.

Using list feeds keys the columns by their column header. It also makes no
claims to preserve the order of the returned columns. List feeds did not
meet my requirements.

So I ended up having to get a cell feed for the entire spreadsheet. To read
the column headers, in order, I examine the first row returned. To read and
store the data, I examine the remaining rows. Unfortunately, because there
is no way to ask for a cell by location, I have to use some backwards logic
to store the data, pseudocode along the lines of:

dim column_headers[columncount];
dim data[rowcount-1][columncount];

foreach cell in feed {
  if (cell.row == 1)
    column_headers[cell.col] = cell.value;
  else
    data[cell.row - 1][cell.col] = cell.value;
}


I find this very awkward, and it also affects object boundaries in my
application design. E.g. I cannot put object construction logic in the
object code itself, such as (constructors take feed and a row number):

column_headers = new column_headers(cellfeed, 1);

for (row = 2 to rowcount)
  data.add(new data_object(cellfeed, row));


=/

Jason

Reply via email to