I am looking at a file with several different cell indents. How do I determine the indent level of each using UiPath?
Do you mean the LookUp Range activity? If so, what would be the “Value to be searched”?
This is the general idea. I would like to look through all of column A and determine the different indent levels for each cell. If you could help me figure out how to find the indent level for one, then I can figure out how to do that rest.
Who even builds Excels like this…
If the indent has been created with this thingy here
it’s probably not that easy. If it’s done with spaces however, you could simply read the range and count the leading spaces
But I’ll accept the challange… will probably take the VBA route.
Yeah it isn’t the easiest haha, and thanks for taking a look! It is from a report that gets generated. I’m guess in the code they have it auto-indenting base on category and subcategory, I can see the indent levels in the format cell section under alignment. My goal is to only grab the ones with a 0 indent level, so the “a” in my example above. I think I found a way to potentially to do part of it with VBA, but it would require me writing a value to the sheet then reading it back off (not the most ideal scenario). If there were a way to return the value per individual row to Uipath that would be helpful. If you have any questions, feel free to ask.
Here’s probably the easiest way
Create a .bas file with the following VBA
Function GetIndent(rg As String) As Long
GetIndent = range(rg).IndentLevel
End Function
(cannot upload it because .bas files are not allowed)
Then use invoke VBA within your Excel Application Scope:
And call your getIdent.bas File and the function name “getIndent”.
As EntryMethodParameters you have to pass an Array (or any other IEnumerable) with the range like so:
The output variable will then contain the indent of your selected cell.
You can easily expand this with either an UiPath For Each loop or (even better) use the VBA code to go through all cells in a range and return all indents in an array.
If this has helped you, please mark this answer as the solution.
I think you may be using a more update version than me, as I am unable to view the activities, could you provide screen shots or a downgraded version? Currently using 2019.10.3
no worries,
open the xaml file in studio
go to manage packages
downgrade the default packages to the version you have in any of your already existing xaml files
or
delete the Project.Json File in that folder and open the xaml
or
Cheers @DavidV
Yes, I am still unable to open the file, although, I am sure that it would work correctly. I also didn’t have a lot of success duplicating it. Currently I have a modified version of some of the VBA that was discussed earlier.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.