spreadsheet.py
def main():
    """
    Gets restaurants out of the shared google spreadsheet

    """
    credentials = get_credentials()
    http = credentials.authorize(httplib2.Http())
    discoveryUrl = ('https://sheets.googleapis.com/$discovery/rest?'
                    'version=v4')
    service = discovery.build('sheets', 'v4', http=http,
                              discoveryServiceUrl=discoveryUrl)

    spreadsheetId = '1x8SICVxkRJm0WvEsVl_regVYIYQaNzsFGqGJyOkp_r4'
    rangeName = 'A1:E100'
    result = service.spreadsheets().values().get(
        spreadsheetId=spreadsheetId, range=rangeName).execute()
    values = result.get('values', [])

    restaurants = []

    if not values:
        print('No data found.')
    else:
        for row in values:
            r = {
                    "genre": row[0],
                    "name": row[1],
                    "price": row[2],
                    "vegan": row[3],
                    "glutenfree": row[3],
                    "meat": row[4]
                }
            restaurants.append(r)

    with open('restaurants.json', 'w') as outfile:
        json.dump(restaurants, outfile)

    Gets restaurants out of the shared google spreadsheet

    
Gets restaurants out of the shared google spreadsheet
Gets restaurants out of the shared google spreadsheet
def main():
    credentials = get_credentials()
    http = credentials.authorize(httplib2.Http())
    discoveryUrl = ('https://sheets.googleapis.com/$discovery/rest?'
                    'version=v4')
    service = discovery.build('sheets', 'v4', http=http,
                              discoveryServiceUrl=discoveryUrl)
    spreadsheetId = '1x8SICVxkRJm0WvEsVl_regVYIYQaNzsFGqGJyOkp_r4'
    rangeName = 'A1:E100'
    result = service.spreadsheets().values().get(
        spreadsheetId=spreadsheetId, range=rangeName).execute()
    values = result.get('values', [])
    restaurants = []
    if not values:
        print('No data found.')
    else:
        for row in values:
            r = {
                    "genre": row[0],
                    "name": row[1],
                    "price": row[2],
                    "vegan": row[3],
                    "glutenfree": row[3],
                    "meat": row[4]
                }
            restaurants.append(r)
    with open('restaurants.json', 'w') as outfile:
        json.dump(restaurants, outfile)
def main ( ) : credentials = get_credentials ( ) http = credentials . authorize ( httplib2 . Http ( ) ) discoveryUrl = ( 'https://sheets.googleapis.com/$discovery/rest?' 'version=v4' ) service = discovery . build ( 'sheets' , 'v4' , http = http , discoveryServiceUrl = discoveryUrl ) spreadsheetId = '1x8SICVxkRJm0WvEsVl_regVYIYQaNzsFGqGJyOkp_r4' rangeName = 'A1:E100' result = service . spreadsheets ( ) . values ( ) . get ( spreadsheetId = spreadsheetId , range = rangeName ) . execute ( ) values = result . get ( 'values' , [ ] ) restaurants = [ ] if not values : print ( 'No data found.' ) else : for row in values : r = { "genre" : row [ 0 ] , "name" : row [ 1 ] , "price" : row [ 2 ] , "vegan" : row [ 3 ] , "glutenfree" : row [ 3 ] , "meat" : row [ 4 ] } restaurants . append ( r ) with open ( 'restaurants.json' , 'w' ) as outfile : json . dump ( restaurants , outfile )
Gets restaurants out of the shared google spreadsheet
Gets restaurants out of the shared google spreadsheet
"""
    Gets restaurants out of the shared google spreadsheet

    """