Retrieve certain columns from Smartsheet api as csv? - smartsheet-api

Is it possible to use the Smartsheet api to retrive only certain columns from a sheet as a csv? The get sheet method is supposed to accept columnIds as a parameter, but I can't get it to work. Maybe this is because I am choosing csv as the acceptable response type and the option is not supported there? I am using cURL.

The Get Sheet as Excel/PDF/CSV operation doesn't support all of the same parameters that the regular Get Sheet operation does. (See the docs I've linked to for details about supported parameters.) Therefore, the scenario you've described (getting only certain columns of data when retrieving the sheet in CSV format) isn't supported, since the Get Sheet as Excel/PDF/CSV operation doesn't support the columnIds parameter.
As a not-very-efficient work around, you could achieve the outcome you're after by using several API requests:
Call the Copy Sheet operation to create a copy of the sheet.
Call the Delete Column operation once for each column you want to remove from the new copy of the sheet.
Call the Get Sheet as CSV operation to retrive the new copy of the sheet (where you've just removed the columns you don't want).
Call the Delete Sheet operation to delete the new copy of the sheet, now that you've retrieved it.
Certainly not very efficient, but this should get you the outcome you're after. Perhaps worth considering if this is a one-time thing you're doing.

Related

Smartsheet: Identifying location of a Column ID without a Sheet ID

We have a custom implementation of the SmartSheet Bridge which is returning the following error in our Run Log:
"The value for cell in column 3928364019935108, INPUT, did not conform to the strict requirements for type CHECKBOX."
The problem is we don't know which sheet this is occurring in which is making it hard to understand what the root cause of the problem is. Is there a way to identify the location of a column without a Sheet ID? Note we have six-thousand Sheets and it's not practical to do this manually.
The path of least resistance for you might be to contact Smartsheet support to explain your scenario and ask for their help in identifying the sheet.
If Smartsheet support is unable to assist, then you could write a script that'd programmatically iterate through all of the sheets that the specified account has access to doing the following for each sheet:
Issue a Get Column request the current sheet.
If the request succeeds, you've found the sheet that contains the specified column --> capture/output sheet ID and sheet name and exit the loop (end processing).
If the request fails (i.e., returns a 404 error code to indicate column not found), move on to the next sheet.
Note that if you're program needs to issue hundreds or thousands of Get Column requests before it finds the sheet and ends processing -- you'll need to insert pauses between batches of requests so that you don't get a rate limiting error (error code 429). The Smartsheet API docs contain info about rate limiting.
If you need help with the script, update your question with a language tag to indicate what language you're going to be using, and add a comment here on my answer. Depending on the language you're using, I may be able to provide more help regarding the specifics of the script.

Smartsheet-api, Is there any way to get manually deleted row using smartsheet api or sdk call

I am deleting row from a sheet, On a sheet I have daily job which needs to recognize the deleted records, I need a way to recognize them using smartsheet api or sdk..
Thanks in advance..
I don't believe this scenario (identifying deleted rows) is explicitly supported by the API at this time. Seems like you could still use the API to achieve your goal though, with a bit more work (code) on your part.
Your code would have to get the sheet data (i.e., all sheet rows) at a regular interval and save that data somewhere -- then each time job runs, get the sheet data again and compare that data to the data you saved the previous time the job ran (to identify any rows that had been deleted).
Edit 9/26: Added Webhooks info
Note that with the approach I've described above, any rows that had been added AND deleted during the interval between job runs would not be detected. If it's important to identify each and every time a row is deleted, a better (and much more efficient) approach would be to use Webhooks. By using webhooks, your application subscribes to notifications for a specified sheet, and then would receive a callback (HTTP POST) from Smartsheet any time the sheet changes. Your application would need to inspect the information in each callback it receives to identify 'deleted row' events (eventType = deleted and objectType = row).
A simple way to do this is to add a column with a checkmark named "delete" or something similar, then with automation you can move the row to another sheet when the flag is detected, the row will be removed from the original sheet, but you will have a record of the deleted row in a different sheet that you can read or do what ever you need to do, this will also prevent deletions by mistake and you can even restore the row back if you need to. I don't think you need much code to implement this solution.

Sharepoint 2013 Rest API call to extract Excel specific cells

This should be pretty straight forward, just haven't been able to find any documentation, so unsure if it is possible, and if it is - how.
I'm calling the Sharepoint 2013 REST API, specifically the Excel REST services (ExcelRest.aspx), to fetch values from specific cells in an Excel workbook.
I've had success with the following two types of calls:
Fetch one specific cell (E5):
http://somesharepointsite.com/testsite/_vti_bin/ExcelRest.aspx/Shared%20Documents/Excelfile.xlsx/Model/Ranges('''Front%20page''!E5')?$format=html
Fetch range (E5-F20):
http://somesharepointsite.com/testsite/_vti_bin/ExcelRest.aspx/Shared%20Documents/Excelfile.xlsx/Model/Ranges('''Front%20page''!E5|F20')?$format=html
However I would very much like to be able to fetch multiple specific cells e.g: E5, E7, F15, F18.
This is due to how the information is placed in the spreadsheet, which isn't really convenient for automated extration. So instead of counting rows/columns to find relevant cells when extracting a range, it would much easier if all cells of relevance could be indicated directly.
I know I could just make a bunch of separate calls fetching one cell at the time, but that doesn't really seem like the optimum solution.
I've tried separating the range with commas, semicolons - also tried making two separate Ranges - no luck
Any suggestions are welcome
Actually, simplify the problem. I would create a hidden sheet that puts all the relevant data in a single range that you can pull from and give it a Named Range. Then call that Range. These values are linked the the master sheet. Hidden only in there's no reason to confuse anyone if they open up the spreadsheet.

PowerApps datasource to overcome 500 visible or searchable items limit

For PowerApps, what data source, other than SharePoint lists are accessible via Powershell?
There are actually two issues that I am dealing with. The first is dynamic updating and the second is the 500 item limit that SharePoint lists are subject to.
I need to dynamically update my data source, which I am currently doing with PowerShell. My data source is not static and updating records by hand is time-consuming and error prone. The driving force behind my question is that the SharePoint list view threshold is 5,000 records however you are limited to 500 visible and searchable records when using SharePoint lists in the Gallery View and my data source contains greater than 500 but less than 1000 records. If you have any items beyond the 500th record that should match the filter criteria, they will not be found. So SharePoint lists are not optional for me until that limitation is remediated
Reference: https://powerapps.microsoft.com/en-us/tutorials/function-filter-lookup/
To your first question, Powershell can be used for almost anything on the Microsoft stack. You could use SQL server, Dynamics 365, SP, Azure, and in the future there will be an SDK for the Common Data Service. There are a lot of connectors, and Powershell can work with a good majority of them.
Take note that working with these data structures through Powershell is independent from Powerapps. Powerapps just takes the data that the data connector gives it, and if you have something updating the data in the background (Powershell, cron job, etc.), In order to get a dynamic list of items, you can use a Timer control and a Refresh function on your data source to update the list every ~5-20 seconds.
To your second question about SharePoint, there is an article that came out around the time you asked this regarding working with large lists. I wouldn't say it completely solves your question, but this article seems to state using the "Filter" function on basic column types would possibly work for you:
...if you’d like to filter the set of items that you are showing in the gallery control, you will make use of a “Filter” expression, rather than the “Search” expression, which is the default that existing apps used. With our changes, SharePoint connector now supports “equals” type of queries on columns that support filtering (Single line of text, choice, numbers, dates and people), so make sure that the columns and the expressions you use are supported and watch for the same warning to avoid reverting back to the top 500 items.
It also notes that if you want to pull from a list larger than the 5k threshold, you would need to use indexes, I have not fully tested this yet but it seems that this could potentially solve your problem.

how to put more than 1 record in an oracle apex form?

I have a problem with oracle apex forms.
The problem is that I want to add more than 1 record at the same time in 1 form. I have already read that the best way to do that is to use an csv file but then there is no tutorial to do that.
Oracle is a database, and combining files with databases is always tricky and not extensively supported for obvious reasons. Storing files and presenting them for download is one thing. Getting an Oracle database to open a file and reading and processing the contents is another. It sure it possible, but especially combining this with an Apex application I think you are going to run into a lot of challenges such as security restrictions.
However, stepping away from files does not necessarily mean stepping away from CSV. You could simply offer a large text input on your page in which a user can copy-paste a large CSV string. This can then be submitted and processed by the database. To do this you would probably need to create a process that gets fired after you submit the page. From this process you can parse the CSV data and insert multiple rows in a table. The same can be done for things like XML or JSON.
However, who is generating this CSV? Requiring a user to construct CSV is not very user-friendly. It can be complicated and error prone. If the CSV is generated by another application, isn't there a way to circumvent Apex and pass the CSV to the database directly?
If a single text-based data carrier is not required, which I doubt reading your descriptions, why not simply keep your form but allow the user to submit multiple forms? Would if be sufficient to insert one record per submit, and later using a batch to query these records and start formatting one at a time?
If you simply want the user to be able to enter multiple machines without having to submit the page for each machine, this is also possible, but you will have to leave some standard Apex functionality behind and implement some more custom javascript and PL/SQL functionality. Apex only allows a static amount of page items, which needs to be defined design time. So if you want to dynamically add fields such as text boxes and select lists to your page, you will have to resort to javascript. You could start by defining a region which renders one row of input fields at page load, and create a link under it saying 'add another row', which will render a new row of input fields under the existing one, and repeat this as many times as the user needs to.
That takes care of the UI. Now when the user has entered all the data he wants, we need to submit all this data and get it into the database. So yes, at this point we would probably have to get all this data from the input fields and turn it into one single string. This would all have to be done client side in your javascript code. You can then use the Apex page item API to assign this generated string to a single page item, using the $x(...) or $v(...) functions. Then submit the page, at which point the page processes will be fired. You then define a page process which will parse the data in your page item, and use that data to insert multiple rows in the database.