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
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 495 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives