18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Sahi-Excel for mixed datatypes in Excel
I have a free-format excel, that has different data types for cells in a column. e.g. cell A2 may be text, and cell A3 may be date type. Can I use the standard _getDB call to read data from my 'free-format' excel? I want to use this excel spreadsheet to perform assertions.
Tagged:
Comments
_getDB always returns column values as strings. So your excel sheet should work I guess. Were you looking for some other information?
Regards,
Narayan
It seems that if the excel has multiple different types of datatypes in a column and we try to read them through _getDB, we will not be able to read all of them. Looks like excel interprets the datatypes of data in a column based on the data in the first few rows in the excel. So to work with excel, since we cannot use ActiveXObjects here, a viable solution seems to be to use Apache POI.
Thanks
First of all, I really wonder why do you have data of different types in the same column!!! Will it be possible for you to store them in different columns?
Otherwise, an easier way would be to store ALL TYPES of data as string and then convert into appropriate data type in your script.
POI, in my opinion, would be an overhead
Anyway, do share your thoughts on the above and if possible your actual requirement
Cheers
dp
I am trying to automate a complex calculations based screen. On the basis of some input fields, say A and B, the other fields on the interface are calculated. Through sahi, I enter the fields A and B, and now need to assert the other fields. At this point, since the other fields are calculated fields, I dont want to redo the calculations. I already have an excel spreadsheet that does it for me. So, all I am trying to do is, populate the spreadsheet also with A and B, and then assert the cell values from the spreadsheet with what I see on the screen.
And these fields are String/Date/Decimal with different precision and so on. Thats the reason my excel is free-format.
I also did not want to go through the POI route, but the other solutions are not working for me.
Thanks
This is a common scenario and we effectively use spread-sheet to achieve based data to drive the tests and assert results. The only difference is that, we map spread-sheet columns to the fields on the application. In your case, I guess, a rearrangement of the data in the spread-sheet into columns should do the trick. This will help us in driving the test with different sets of data too, each row representing separate sets.
Please have a look at the following link, http://sahi.co.in/w/working-with-excel-sheets, if you have not already gone through it.
Cheers
dp