I’m learning how to use the Google spreadsheet API to get info from a spreadsheet and insert info to him.
I got the basic stuff with some examples from google, but I want to do something a little more advanced.
I got 2 lists in the spreadsheet, something like this:
A B
1| WebsiteList1 | WebsiteList2
2| www.google.com | www.blabla.com
3| www.yahoo.com | www.someWebsite.com
4| www.cnn.com | www.cantThinkOfAbother.com
I want to choose 1 of the list, based on columns titles (WebsiteList1 or WebsiteList2)
I’m trying to change this code to do this, but with no luck (not sure what to do):
public void GetAllWebSitesListFromWorkSheet(string spreadsheetName,string colmnTitle)
{
WorksheetEntry entry = getWorkSheetByTitle(spreadsheetName);
CellQuery myCellQuery = new CellQuery(entry.CellFeedLink);
CellFeed cellFeed = service.Query(myCellQuery);
foreach (CellEntry cell in cellFeed.Entries)
{
Console.WriteLine(cell.Value);
}
}
What do I need to change in the CellQuery object, to get all the sites under WebsiteList2 ?
Ok, afther some time of messing around, I found a way to get only 1 colmn!
Here is the way.
first of all we need to use ListFeed, so we can get complete rows.
ListFeed is a collection that represnt the rows on the spreadsheet.
row.elements is a collection that represent the cells of the row.
so this is the way to get 1 colmn (based on the spreadsheet in the question):
for info about getting the SpreadSheet and connection stuff go HERE.
this is only 1 way i found, i would like to know if somone know about a diffrent way to get a colmn base on his header.
(sorry for my english)