Example #1
0
            private void ParseWorksheetEntry(Google.GData.Spreadsheets.WorksheetEntry in_entry, Google.GData.Spreadsheets.SpreadsheetsService in_service, bool in_bFirstRowValueTypes)
            {
                if (in_entry == null)
                {
                    Debug.LogError("Could not read WorksheetEntry - retry count:  ");
                    return;
                }

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

                // Fetch the list feed of the worksheet.
                var listQuery = new Google.GData.Spreadsheets.ListQuery(listFeedLink.HRef.ToString());
                Google.GData.Spreadsheets.ListFeed listFeed = in_service.Query(listQuery);

                //int rowCt = listFeed.Entries.Count;
                //int colCt = ((ListEntry)listFeed.Entries[0]).Elements.Count;

                if (listFeed.Entries.Count > 0)
                {

                    int curRow = 0;
                    // Iterate through each row, printing its cell values.
                    foreach (var atomEntry in listFeed.Entries)
                    {
                        var row = (Google.GData.Spreadsheets.ListEntry)atomEntry;

                        // skip the first row if this is a value type row
                        if (curRow == 0 && in_bFirstRowValueTypes)
                        {
                            curRow++;
                            continue;
                        }

                        if (row.Title.Text.Equals("VOID", StringComparison.OrdinalIgnoreCase))
                        {
                            curRow++;
                            continue;
                        }

                        int curCol = 0;
                        // Iterate over the remaining columns, and print each cell value
                        foreach (Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements)
                        {
                            // this will be the list of all the values in the row excluding the first 'name' column
                            if (curCol > 0)
                                EntryStrings.Add(element.Value);
                            curCol++;
                        }
                        EntryStride = curCol - 1;

                        curRow++;
                    }
                }
            }