I’ve found several calls in the API documentation relating to auto-filters but keep getting an error response “UnsupportedApiVersion” when I try to add one using the following api call:
I have a feeling that I’m missing a step before calling the autofilter method but for the life can’t figure it out so any help/direction would be greatly appreciated.
I’m using the Cell Cloud product via the Laravel SDK (PHP), the SDK doesn’t actually contain a ready made call for this so I extended the class to add the functionality.
We are updating Aspose.Cells for Cloud PHP SDK to include all AutoFilter APIs. I will update you in this thread once the PHP SDK and Examples are updated.
I am pleased to inform you that we have added AutoFilter APIs to Aspose.Cells PHP SDK. Examples are also added to GitHub repository that indicates how to use these APIs. Docs are also updated with PHP Examples.
I was finally able to get back to this for testing and ran into another problem. It seems like I can only create one auto-filter at any given time. If I create an autofilter on multiple columns only the last one comes up with the autofilter. I thought it might be the field index, but all I get are out of range errors if I use anything other than 0.
fieldIndex indicates Column index. You need to ensure you are setting an appropriate value to range parameter before setting fieldIndex. E.g. if I set range parameter value to “A1:C13” I can set fieldIndex to either 0, 1 or 2.
AutoFilter can be applied to one column at a time. If you want to apply a filter to multiple columns, you need to call the same API multiple times with different argument values (fieldIndex, criteria).
It doesn’t seem like the filters are being saved in between autofilter requests. Here is a better example of what I’m experiencing:
Create a new empty workbook.
Add a Worksheet.
Import data from a previously uploaded CSV file
Freeze the first row
Format the header row (bold/bgcolor/fontcolor)
Add autofilters to each column in the header row by looping through the headers (see example curl PUT calls below)
http://api.aspose.cloud/v1.1/cells/autofilter_test.xlsx/worksheets/Results/autoFilter/filter?range=A1:A7&fieldIndex=0&criteria=Location
http://api.aspose.cloud/v1.1/cells/autofilter_test.xlsx/worksheets/Results/autoFilter/filter?range=B1:B7&fieldIndex=0&criteria=Bin
http://api.aspose.cloud/v1.1/cells/autofilter_test.xlsx/worksheets/Results/autoFilter/filter?range=C1:C7&fieldIndex=0&criteria=Bin Zone
http://api.aspose.cloud/v1.1/cells/autofilter_test.xlsx/worksheets/Results/autoFilter/filter?range=D1:D7&fieldIndex=0&criteria=Description
http://api.aspose.cloud/v1.1/cells/autofilter_test.xlsx/worksheets/Results/autoFilter/filter?range=E1:E7&fieldIndex=0&criteria=Bin Pick Sort
http://api.aspose.cloud/v1.1/cells/autofilter_test.xlsx/worksheets/Results/autoFilter/filter?range=F1:F7&fieldIndex=0&criteria=Created At
http://api.aspose.cloud/v1.1/cells/autofilter_test.xlsx/worksheets/Results/autoFilter/filter?range=G1:G7&fieldIndex=0&criteria=Date Retired
Auto size the columns
Download the final document
The end result is only one autofilter on the last requested autofilter column. It is almost like it is not saving the document in between requests. If I stop the loop early, the autofilter resides on the stopped column.