Python Google Sheets API: Read All Rows

Jul 2, 2019
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.


❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.