I am trying to use the Smartsheet api (Python sdk) to insert values from a text file into individual cells in the Smartsheet. Is it possible to insert a value into a cell with drop downs and choose the desired value of the dropdown (and leave the other options available)? If it's possible the sample code would be much appreciated.
To expand with an example...
Say I have a text file where one of the values to be inserted is "Fridge" and that word needs to be selected in a cell containing four drop down options: Fridge; Washer; Dryer; Microwave. Can I somehow select the "Fridge" option from the drop down list using the API, and leave the other drop down elements available (ie don't just replace the four options with the text "Fridge")?
Yes, it's possible via API to set the selected value for a dropdown list cell in Smartsheet.
Using your example, here's what the dropdown list looks like in my sheet:
To select one of those values for a cell (in an already existing row) in this sheet, I simply execute an Update Row(s) request as shown here, to set the value of the specified cell to "Fridge":
PUT https://api.smartsheet.com/2.0/sheets/SHEET_ID/rows
[
{
"id": "ROW_ID",
"cells": [
{"columnId": COLUMN_ID,"value": "Fridge"}
]
}
]
After this API request is executed, I can see that the value "Fridge" is selected for the specified cell in my sheet, and the dropdown list is preserved.
Likewise, if the row doesn't yet exist, you can use the Add Row(s) operation to add the new row with the specified list value selected for the specified cell.
For a code sample that shows how to use the Update Row(s) operation with the Python SDK, see here: https://smartsheet-platform.github.io/api-docs/?python#update-rows.
For a code sample that shows how to use the Add Row(s) operation with the Python SDK, see here: https://smartsheet-platform.github.io/api-docs/?python#add-rows