Excel activities desperately need a way to force the columns to be string

I’m reading an Excel file and no matter what I do all the columns come up as System.Object. I’ve tried modern, I’ve tried Workbook, I’ve tried all the different “read format” options, preserve format on and off, nothing works. All the columns are always system.object and this causes problems later.

My only solution is to write it to CSV then read it back in so I can get it as all string columns. I shouldn’t have to do this. The Excel activities need some major improvements in how column datatypes are handled.

Can you please elaborate how you “read” the excel file?

I tried both the Use Excel/Read Range modern activities and the Workbook Read Range.

I don’t know what you’re trying to say here. Also, when you use AI to generate a reply you’re supposed to note that you used AI.

Not that it fixes ‘the’ problem, but would downgrading your excel.activities version to a stable one, where you use ‘classic’ excel activities work for you? There I’m used to strings being strings…

(also since I really dislike most of the ‘modern’ way of working, it broke more than it fixed)

Modern is far superior to classic. You just have to get used to how it works. There are, of course, times where classic activities are still useful.

The solution to the issue here was just to use Output Data Table to get the whole DT into a CSV string, then use Generate Data Table to recreate the datatable from the CSV. Now all columns are string.

When you use read ranage, you will get a datatable. For example dtYourDataTable. If you would read data from it, you would refer to it as dtYourDataTable(rowindex)(columnindex).ToString to get a string output.
If you just use dtYourDataTable(rowindex)(columnindex) then that would be an object

I’m not trying to get output. I’m trying to do filtering and comparison, which doesn’t work right when the columns are system.object. I’m plenty familiar with how Read Range works. This is a feedback post not a help post. If you do it right, dtYourDataTable(rowindex)(columnindex) will be string or some other datatype depending upon your data.

Thank you @postwick for your feedback.

We will take it into consideration for future improvements. There are a few things to consider that stopped us for doing this until now.

  1. What if your column is not a String from top to bottom? Or what if your column is not a DateTime from top to bottom how would you make the transformations?

We are looking for an elegant way to return a DataTable where each DT Column type matches the Excel column type. The problem is that you can have an Excel where the Excel Cell type is not the same from top to bottom, so you don’t know what type the DT Column to be.

The quality of the source data is my responsibility. Give us a way to tell the activities which datatype to use for each column. I want control, not something that decides for me. Aside from the context of Excel, this is an issue I have in other areas of UiPath as well. Like how you took the datatype selection out of the For Each activity. We need to have control and options, we don’t need the system to make decisions for us - that may work fine most of the time but when it doesn’t, it’s a major issue.

Totally agree here.
Microsoft has this as a big handicap in my opinion, and UiPath has shown this behavior more and more as well.
My guess is that it is to target the ‘less capable’ developers in order to facilitate how easy it is to build your first simple robot. The big downside, for when you do know what you’re doing, is that these simplifications often block out any form of control or customization options, other that resorting to coding again.

There was some hope with Studio X being the version for the citizen developers, but it’s all slowly blending into some hybrid monstrosity where nobody gets what they want to use.