I'm trying to write a Google Document script and it's going terribly. I am appending all of the information from specific rows to a list and I want to print out a certain item in that list. eg The second thing it adds to the list. However that would be easy right? But I'm having to append the list to a list. So I have a list of lists.
And Now I don't know how to get the script to just print out the 2nd item of each list inside of the list.
This is my code-
if not spreadsheet_key:
print >>sys.stderr, 'No Spreadsheet Key given'
sys.exit()
worksheet_id = 'od6'
storage = Storage(r'P:\Bureau Schedule\auto_drive_creds')
credentials = storage.get()
if credentials.access_token_expired:
credentials.refresh(httplib2.Http())
spr_client = gdata.spreadsheet.service.SpreadsheetsService(
additional_headers={'Authorization' : 'Bearer %s' % credentials.access_token}
)
q = gdata.spreadsheet.service.CellQuery()
q.return_empty = 'true'
cells = spr_client.GetCellsFeed(
spreadsheet_key,
worksheet_id,
query=q
)
batchRequest = gdata.spreadsheet.SpreadsheetsCellsFeed()
lst_a = []
for i, cell in enumerate(cells.entry):
lst_b = []
if cell.title.text.startswith('AG'):
if cell.content.text == '2':
lst_b.append([cells.entry[i-30].cell.inputValue, cells.entry[i-29].cell.inputValue, cells.entry[i-25].cell.inputValue])
lst_a.append(lst_b)
print lst_a[0]
I'm expecting quite an easy answer but I'm unsure and I've been stuck for a quite awhile so I thought I may as well ask.