Is there any API to get the sheets with the exact name and location?
I wanted to get the list of the sheets with the exact name I provide , also from the exact location either from workspace, folder or home. By exact name I mean returned sheets name should match complete string with given name and not just contain that string.
Answers
-
Hi @Roshan
You can use the Get / Search method to look for exact text by adding double quotes around the text you're looking for: https://smartsheet.redoc.ly/tag/search
However Search will return any Smartsheet item with that exact text, including values in cells. You'll want to then check the objectType and make sure it's "sheet". The contextData will identify where the sheet is located in regards to the Workspace (either general "Sheets" or another Workspace), and then following folders.
For example, if I was looking for my report called "Report for Calendar App" this is what I would do:
https://api.smartsheet.com/2.0/search?query="Report for Calendar App"
Returns:
{ "results": [ { "text": "Report for Calendar App", "objectType": "report", "objectId": xxx, "contextData": [ "Genevieve's Testing Workspace > Calendar Sheets" ] } ], "totalCount": 1 }
My Workspace is Genevieve's Testing Workspace and the folder is Calendar Sheets.
Here's an example if I look for the text "Task 1". It shows a Sheet and a Row with this exact text. You can see that my Sheet is located in the general home "Sheets" folder.
https://api.smartsheet.com/2.0/search?query="Task 1"
{ "results": [ { "text": "Task 1", "objectType": "sheet", "objectId": xxxx, "contextData": [ "Sheets" ] }, { "text": "Task 1", "objectType": "row", "objectId": xxx, "parentObjectType": "sheet", "parentObjectId": xxx, "parentObjectName": "Find Date", "contextData": [ "Task 1" ] },
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
How we can use the location attribute in the search API?
-
Hi @Roshan
The Search results will return contextData that identifies the location of the sheet. Is this what you meant?
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
In the search Everything API, there is a parameter called location. Could you tell me how to use it? I'm not sure if I can use this parameter to filter the result instead of iterating the API response by checking contextData.
-
Hi @Roshan
Would you be able to identify where you see the "location" parameter in the current API Documentation?
In the Search Everything documentation the only parameter specified is the query string to search for:
The StackOverflow community may have some additional examples of how to use the Search Everything request.
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
This is one of the document where location parameters is used in search API.
https://smartsheet-platform.github.io/api-docs/?javascript#search-everything
-
Hi @Roshan
Thank you for clarifying!
This is specific to whether or not the location is in a workspace that the user owns:
location
(optional): when specified with a value of personalWorkspace, limits the response to only those items in the user's workspaces.I don't believe there's a way to use this to identify a specific workspace more than the basic filter.
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