Add_Row Data Format
Hello,
I am having issues adding rows of data to my sheet through the smartsheet python sdk. I am successfully able to import files and create sheets but when I try using add row via the add_row method, but I see no update or data being added to my sheet. I am even getting SUCCESS status message back from the api request. I am now questioning whether or not my data is in the correct format. The format I am trying to upload is a pandas dataframe converted into an array of dictionaries. All keys in the dictionaries correspond to the columns in the smartsheet. Is this not an acceptable format per the documentation?
Best Answer
-
Hello Versatile_Red00,
This might be a reach but have you tried setting the strict variable to false.
# Specify cell values for one row row_a = smartsheet.models.Row() row_a.to_top = True row_a.cells.append({ 'column_id': 7960873114331012, 'value': True }) row_a.cells.append({ 'column_id': 642523719853956 'value': 'New Status', 'strict': False })
This will add the values into the cells even if it does not match the properties.
Answers
-
Here's the documentation, sounds like you have it already but just in case:
I don't have any specific suggestions for your use of Python as I use the API over REST HTTP endpoints and JSON.
One simple tip is that sometimes the rows ARE being added, but you aren't seeing them because they are too far down the page. I know that sounds dumb, but it's caught me out before. Rows add under the last row on the sheet, and if there's a block of blank rows sometimes that add will happen but you need to scroll to find it.
Otherwise, make sure you're including the location value (toTop, toBottom, etc) and the correct column Ids and you should be ok. Also ensure your destination sheet columns don't have column formulas in them and aren't set to "Restrict" checkboxes in the properties, that can often have unexpected results when using API. API won't write to column formula cells.
-
Oh, another tip - Add Rows can only handle 500 row object arrays. That's not really documented anywhere. So you need to chunk up your rows into arrays of 500 or less.
-
Hello Versatile_Red00,
This might be a reach but have you tried setting the strict variable to false.
# Specify cell values for one row row_a = smartsheet.models.Row() row_a.to_top = True row_a.cells.append({ 'column_id': 7960873114331012, 'value': True }) row_a.cells.append({ 'column_id': 642523719853956 'value': 'New Status', 'strict': False })
This will add the values into the cells even if it does not match the properties.
-
Is there a limit to the amount of api calls?
-
There doesn't seem to be a firm limit on rate, they just say they reserve the right to limit the rate at which you execute the calls. And I don't think there's any limit on total calls, just rate.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.1K Get Help
- 414 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