How to find last row and coloumn in excel sheet for string and integer both
Hi @mahesh.shelke,
If you read the entire excel sheet without specifying the range, you would know how much rows and columns it has. I believe you could begin with that strategy.
Hi @mahesh.shelke,
Use Read Row, Read Column activity to get the Row, Column counts respectively.
When you use Read Row or Read Column the Output will be stored in a List, then use [You_List_Name].COUNT.TOSTRING to get the Row/Column count.
Hi I got itâŚ
If we use Read Row or Read Column it will give the total count of rows and not the last row or coloumn.
I tried it with READ RANGE and DatatableVariable.Rows.COUNT.TOSTRING and it worked.
Thanks
Did you put the "DatatableVariable.Rows.COUNT.TOSTRING " into the output of Read Range? When I do I get an error: Value Type âStringâ can not be converted to âSystem.data.datatableâ. my variable rowsCount is set as a variable type of datatable as well. Any thoughts?
Hey Donât put "DatatableVariable.Rows.COUNT.TOSTRING " directly into an output of read range.
Follow this steps:
Take excel application scope then give your excel path in that.
Inside excel application scope drag Read Range Activity and in output of ReadRange create data table variable to store data from excel.
Then use assign activity and in create variable âcountExcelâ(take type as int) and inside TO field write "DatatableVariable.Rows.COUNT ".
Hi
Your definition is working fine for getting the total count of rowsâŚbut it is not fetching the total count of columns in the excelâŚhow to get both the row and column count???
Hi Nirsha,
This might help you.
"Row count : "+dtVariable.Rows.Count.ToString
"Column count : "+dtVariable.Columns.Count.ToString
Regards,
Rahamat
yea i did thatâŚthank you!!!
and one more thing
i have got the range and column index alsoâŚi just want combine it and select the range
for example: starting range is A1 that is fixed, using row count i have got the count as 153 and column header as ASâŚhow to combine this AS+153 in read range
ReadRange=âA1 : AS153â i want this formatâŚhelp me out of this
Hi,
Use below code to get number of columns in excel.
First read Excel in data table and then use following code:
datatableName.Columns.Count.ToString
Thanks,
Pravin Patil
(9890924097)
Innowise
âA1:â+âAS:â + datatableName.Rows.Count.ToString
Hi
But that AS is also not fixedâŚa variable is holding that column index.if so how to represent that
I have done with this code its working exactly how i want âA1:â + Column_Name.ToString + countRows.ToString.
Thank you @pravin.patil
WelcomeâŚAnd All the best
Hi
But while getting the count it is not taking the empty cells also.for getting the empty cells which is also there in particular column or row what function i should use??
Can you tell me scenarioâŚit must take empty cells but I donât know why it is not taking that empty oneâŚBy adding write-line or message box check if empty cells are reading or notâŚI think it is readingâŚor if possible share excels or snap âŚ
This is the scenarioâŚif i put "DatatableVariable.Rows.COUNT " it is displaying the value as 6 not as 7
Counter start from 0 so that it is correct and reading empty also
counter is starting from 0 only.can you give me a sample code for this excel
Main.xaml (5.9 KB)