How can I a single cells value using API?
I have the below code, I am trying to get the value a specific cell but I am getting the 1006 error. However if I modify this for a put request, it works without issue? also to note, I am doing this in vb
Sub GetCompletedCellValue(apiKey As String, sheetId As Long, rowId As Long, columnId As Long)
Using client As New HttpClient()
client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", apiKey)
Dim getResponse As HttpResponseMessage = client.GetAsync($"https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/cells/{columnId}").Result
If getResponse.IsSuccessStatusCode Then
Dim responseContent As String = getResponse.Content.ReadAsStringAsync().Result
Dim cellData As JObject = JObject.Parse(responseContent)
Dim cellValue As String = cellData("value").ToString()
Debug.WriteLine("Current cell value: " & cellValue)
Else
Debug.WriteLine($"Error getting cell value: {getResponse.Content.ReadAsStringAsync().Result}")
End If
End Using
End Sub
Answers
-
Hey @CHIRS GOLPHIN
I'm not familiar with VB, however I would suggest if you're using GET to GET the entire row.
https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}
Then you can loop through the Cells array that is returned for the row to find the column and cell data you're looking for. Here's the API Docs for Get Row: https://smartsheet.redoc.ly/tag/rows#operation/row-get
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
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