How to get list of rows of selected sheet in Smartsheet using REST? - rest

I'm trying to get list of rows of selected sheet. I went for REST API for rows List of row's related calls but didn't get any resource to get list of rows.
How can I get list of rows? or the REST call have not been written yet.

You can get a list of rows by using the Get Sheet operation. The response will contain the list of rows in the sheet, the list of columns in the sheet (which you'll need to interpret the cells data within the rows collection), along with sheet-level properties and any other data you've requested by using the include parameter.

Related

Getting the underlying data in tableau

The data representation was created in Tableau and I am accessing and showing it on my website through the Tableau JS API: link to the API.
Obtaining the viz and showing my Tableau have already been done. I have a Bar Chart showing my data in horizontal columns. The idea is that I want to be able to click on a column and then get the data which goes into this column.
Let's say we have 12 elements. They are represented by 3 columns. The first column has 5, the second 3 and the third 4 elements. In my case, after selecting the column with 4 elements I would want to be able to get the underlying 4 data entries.
I have been going through the API Documentation (link) and I have added on click listener for marksSelection. However, it only returns me the "sorting conditions" so to say. I tried getting the getUnderlyingDataAsync and then getData() but the returned data is not really in a format which I can use (since there are only pairs of row and column and not the full data entries).
Is something like this possible?
I solved it in a couple of steps following the API:
getUnderlyingDataAsync to obtain a DataTable, save it to an object called dataTable.
Get all of the (raw) data by calling dataTable.getData(). It returns a 2D array. To help you imagine the structure, let's say that the data source has 50 objects then the array will have a length of 50. If each object has 5 properties then the nested array will have a length of 5 (with each property represented as 1 element).
Get all of the columns by calling dataTable.getColumns(). Here you will need the name and index properties.
Create an object containing our actual JSON data by combining the columns in (3) and the (raw) data from (2).
Now you should have a structured array of objects.

ag-grid get filtered rows

I've got a grid with a filter applied to it.
I have a button which selects all of the rows in the grid and performs some action. I want to retrieve the filtered rows in this method. How is this possible?
I've come across this previous question however this requires using a filterChanged event to maintain a copy of the filtered rows. I do not want to do this, I would prefer to just query the grid directly for the filtered rows.
gridApi.getModel();
This will Return the row model inside the table. From here you can see the original rows, rows after the filter has been applied, rows after aggregation have been applied, and the final set of 'to be displayed' rows.

Get Children of Parent Row

Is there any way to get all of the children of a parent row? The only method that I see, is to grab all of the rows and look at the parentId's assigned to the children.
(For what it is worth, I am using the javascript api)
I don't believe it's currently possible to explicitly request all child rows of a specified row, using the SmartSheet API.
As you've described in your post, you'd need to use the Get Sheet operation to get the list of all rows in the sheet, then look for row objects in that result set where parentId matches the id of the parent row you're interested in.

Using Smartsheet API 2.0 how to get ONLY the 'modifiedAt' property of a specific sheet

I need to get the last modified timestamp property of a sheet using Smartsheet API 2.0 (preferably Python SDK).
Ref:
https://smartsheet-platform.github.io/api-docs/
https://github.com/smartsheet-platform/smartsheet-python-sdk
Using Sheets.list_sheets I am able to get the 'modifiedAt' property (along with other properties) for all the sheets that I have access to.
Using Sheets.get_sheet(sheet_id) I get all the data (rows, columns) for the specified sheet.
How do I get only the 'modifiedAt' (it's OK if some other small properties are also present) for a specific sheet with a known sheet ID. I don't want the row, column, cell information to be present in the API response.
I wrote to Smartsheet support team and their answer served my purpose.
Thanks for contacting Smartsheet Support. In order to narrow down the
response that you're getting, you can use the exclude parameter:
http://smartsheet-platform.github.io/api-docs/#query-strings. In my
testing, I excluded all rows and columns where columnIds=0 and
rowIds=0. That left me with only the Sheet information, which includes
the modifiedAt for the sheet. You may be able to limit it further, but
the result I got from this was pretty short and sweet.
(Python SDK example)
response = ss_client.Sheets.get_sheet(MY_SHEET_ID, column_ids='0', row_ids = '0')
Using the above parameters, I was able to exclude all the sheet data and got only the metadata (which included modifiedAt property).
Basically my intention was to run a sync script periodically and store the Smartsheet data into my local db. I wanted the API response to skip the actual Sheet data (rows, columns, cells) if nothing would have changed since the last execution. Another nifty way of achieving this to use the ifVersionAfter parameter.
ifVersionAfter (optional): If version specified is still the current
sheet version, then returns an abbreviated Sheet object with only the
sheet version property. Otherwise, if the sheet has been modified,
returns the complete Sheet object. Intended to allow clients with a
cached copy to make sure they have the latest version.
last_version_fetched = 7724
response = ss_client.Sheets.get_sheet(MY_SHEET_ID, if_version_after=last_version_fetched)
The Get Sheet call will always return the content (row, column, data) from a specific sheet. While there is an 'exclude' query parameter that can filter out some properties, it does not work on the primary sheet data returned from the /sheets/{sheetId} endpoint.
The Sheets.list_sheets call seems like the easier route if you only need the modifiedAt property. I would use that one then iterate over the results until you find the matching id.

Google Chart - DataTable inside a form

I have a table created with DataTable of Google Chart, which has a column with a drop-down list. In this way the user can set the proper value of a row.
I am working in Python and Flask and I can retrieve the request data correctly. The problem is that the table, given the amount of data, is showed in pages, each one with 20 rows. When I retrieve the request I get only those 20 rows, so I have no way to know what the user set in the other pages.
How can I get the values of all pages?
Moreover, I noticed that when I change page and then I go back, the table forgets the user changes, so I think I should be careful also to this fact.
Finally, I solved the problem by using a dictionary containing all the changes made to the table and updating the html string inside the table to keep the content updated.