pythonsdksmartsheet-api

How to use simple_smartsheet library?


I wanna use simple_smartsheet to update rows in Smartsheet by Python, but I even cannot open the Smartsheet with this library. I still try to open Smartsheet

import os
from datetime import date
from pprint import pprint

from simple_smartsheet import Smartsheet
from simple_smartsheet.models import Sheet, Column, Row, Cell, ColumnType

TOKEN = os.getenv('SMARTSHEET_API_TOKEN') # MY TOKEN HERE
SHEET_NAME = "BIM Request Measures Testing"
smartsheet = Smartsheet(TOKEN)

sheets = smartsheet.sheets.list()
print(sheets)

This is what the console showed


  File "C:\Users\kvuong\AppData\Local\Programs\Python\Python311\Lib\functools.py", line 864, in register
    raise TypeError(
TypeError: Invalid first argument to `register()`. typing.Dict[typing.Tuple[str, ...], simple_smartsheet.types.IndexType] is not a class or union type.

I refer to that book Reference

I hope you can help me connect to Smartsheet by Python, Many thanks


Solution

  • Unfortunately, simple-smartsheet is not actively maintained anymore. The last update is from February 2020. It seems that the library does not work with newer versions of Python. I tried using it with Python 3.11, 3.10 and 3.9 and got the same error.

    The latest version of Python in which I managed to import Smartsheet from the library without any errors was Python 3.8.10. So, to resolve this issue switch to an older version of Python.

    Edit 2 Jan 2023:

    There is a pull request to fix this issue.