Python get_columns response.
I am trying to find specific columns through the python api.
Running something like
listColumns = smartAPI.Sheets.get_columns(83053825###, include_all=True)
gives me the object and not the Field Name.
[<smartsheet.models.column.Column object at 0x000001FBBBD26C18>, <smartsheet.models.column.Column object at 0x000001FBBBD4D2B0>, <smartsheet.models.column.Column object at 0x000001FBBBD4D860>, <smartsheet.models.column.Column object at 0x000001FBBBD4DCF8>, <smartsheet.models.column.Column object at 0x000001FBBBD101D0>, <smartsheet.models.column.Column object at 0x000001FBBBD10668>, <smartsheet.models.column.Column object at 0x000001FBBBD10B00>, <smartsheet.models.column.Column object at 0x000001FBBBD10F98>, <smartsheet.models.column.Column object at 0x000001FBBBD13470>,
...]
How do I go about finding the Name?
Best Answer
-
Hey @MikeG_O
It looks like you may just need to resolve the response (i.e.
columns = listColumns.data
). Here's the API Documentation and example: List ColumnsLet me know if this has helped!
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Answers
-
Hey @MikeG_O
It looks like you may just need to resolve the response (i.e.
columns = listColumns.data
). Here's the API Documentation and example: List ColumnsLet me know if this has helped!
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Hi @MikeG_O
Genevieve is correct. You need to access the data.
The options are to loop over listColumns, like the below:
for x in listColumns.data:
print (x.title)
or
print ([x.title for x in listColumns.data])
-
Thanks that worked.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives