def _export_spreadsheet(client, spreadsheet_key, worksheet_id, headers):
 cleaned_headers = _get_cleaned_headers(headers)
 spreadsheet_lines = [headers]
 rows_feed = client.GetListFeed(spreadsheet_key, worksheet_id, visibility='public', projection='values')
 while True:
  found_data = False
  for row in rows_feed.entry:
   line = []
   for (header_idx, (header, cleaned_header)) in enumerate(zip(headers, cleaned_headers)):
    try:
     cell_data = row.custom[cleaned_header].text
    except KeyError:
     raise GoogleSpreadsheetError(("Could not map header '%s' to Google Spreadsheet's internal representation of the header. We suggest changing the name of the header in your Google Spreadsheet to be alphanumeric if possible, as this will likely solve the issue. Note that the name isn't *required* to be alphanumeric, but it may fix issues with converting to Google Spreadsheet's internal format in some cases." % header))
    if ((not found_data) and (header_idx == 0) and cell_data.lstrip().startswith('#')):
     line.append(cell_data)
     break
    else:
     line.append(cell_data)
     found_data = True
   spreadsheet_lines.append(line)
  next_link = rows_feed.GetNextLink()
  if next_link:
   rows_feed = client.Get(next_link.href, converter=SpreadsheetsListFeedFromString)
  else:
   break
 return spreadsheet_lines

def _export_spreadsheet ( client , spreadsheet_key , worksheet_id , headers ) : cleaned_headers = _get_cleaned_headers ( headers ) spreadsheet_lines = [ headers ] rows_feed = client . GetListFeed ( spreadsheet_key , worksheet_id , visibility = 'public' , projection = 'values' ) while True : found_data = False for row in rows_feed . entry : line = [ ] for ( header_idx , ( header , cleaned_header ) ) in enumerate ( zip ( headers , cleaned_headers ) ) : try : cell_data = row . custom [ cleaned_header ] . text except KeyError : raise GoogleSpreadsheetError ( ( "Could not map header '%s' to Google Spreadsheet's internal representation of the header. We suggest changing the name of the header in your Google Spreadsheet to be alphanumeric if possible, as this will likely solve the issue. Note that the name isn't *required* to be alphanumeric, but it may fix issues with converting to Google Spreadsheet's internal format in some cases." % header ) ) if ( ( not found_data ) and ( header_idx == 0 ) and cell_data . lstrip ( ) . startswith ( '#' ) ) : line . append ( cell_data ) break else : line . append ( cell_data ) found_data = True spreadsheet_lines . append ( line ) next_link = rows_feed . GetNextLink ( ) if next_link : rows_feed = client . Get ( next_link . href , converter = SpreadsheetsListFeedFromString ) else : break return spreadsheet_lines
returns a list of lists containing the entire spreadsheet .