List Discussions function limited characters
Hello,
I am trying to pull all discussion and comments associated with a sheet ID.
I was able to pull using the API through python as shown below.
However the comments came in with only limited characters, in other words I can only see the first 100 characters. Please advice
PYTHON CODE BELOW
"
import smartsheet
import pandas as pd
#Set the Access Token
SMARTSHEET_ACCESS_TOKEN = "xxxxxxxx"
# Initialize client
smartsheet_client = smartsheet.Smartsheet(SMARTSHEET_ACCESS_TOKEN)
#Set the Sheet_id
sheet_id = xxxxxxxx
sheet = smartsheet_client.Sheets.get_sheet(sheet_id)
print("Loaded Sheet: " + sheet.name)
#Call the discussions for the specified sheet
response = smartsheet_client.Discussions.get_all_discussions(sheet_id,include_all=True)
discussions = response.data
#Transform the discussion data to dictionary format
discussionsDict = response.to_dict()
#Create a comments dataframe from the discussion dictionary
commentsdf = pd.DataFrame.from_dict(discussionsDict['data'])
#Save the comments dataframe to a csv file
commentsdf.to_csv('comments.csv')
"
Best Answer
-
Hi @telduzdar,
I think that instead of the comment, you are seeing the discussion title, which is created by "duplicating the first 100 characters of top-level comment." (https://smartsheet.redoc.ly/#operation/discussions-list, response, data, title)
To include the comments to the data response, you should add include = 'comments' to your call:
response = smartsheet_client.Discussions.get_all_discussions(sheet_id,include_all=True, include='comments')
Hope that helps!
Answers
-
Hi @telduzdar,
I think that instead of the comment, you are seeing the discussion title, which is created by "duplicating the first 100 characters of top-level comment." (https://smartsheet.redoc.ly/#operation/discussions-list, response, data, title)
To include the comments to the data response, you should add include = 'comments' to your call:
response = smartsheet_client.Discussions.get_all_discussions(sheet_id,include_all=True, include='comments')
Hope that helps!
-
Thanks a lot @JKrombeenASK that parameter did it!
Much appreciated!
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
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives