credentials = ...service = build('sheets', 'v4', credentials=credentials)sheet = service.spreadsheets()SPREADSHEET_ID = ...SHEET_NAME = ...range_notation = SHEET_NAMEvalue_render_option = 'FORMATTED_VALUE' # UNFORMATTED_VALUE, FORMULAdate_time_render_option = 'SERIAL_NUMBER' # FORMATTED_STRINGresult = sheet.values().get(spreadsheetId=SPREADSHEET_ID, range=range_notation, valueRenderOption=value_render_option, dateTimeRenderOption=date_time_render_option).execute()values = result.get('values', [])if not values: print('No data found.')else: for row in values: print(row)
NOTE: Refer Setup and Access Google Sheets API With Python.
References: