SH_K
(SH K)
November 6, 2023, 8:21am
1
I am beginner of RPA but I can handle python.
I would like to use RPA instead of python to control code below.
import pandas as pd
df = pd.read_excel(‘wdwdwd.xlsx’) # only one column ‘A’
str_a = ‘’
for num in range(df.shape[0]) :
str_a = str_a + df[‘A’].iloc[num] + ‘\n’
I would like to get ‘str_a’.
but I can not find the way to do same above.
Anil_G
(Anil Gorthi)
November 6, 2023, 8:25am
2
@SH_K
use read range activity to read the excel into datatable dt
use requiredstr = String.Join(Environment.NewLine,dt.AsEnumerable.Select(function(x) x(0).ToString))
this will get full first column values concatenated with newline character
cheers
Yoichi
(Yoichi)
November 6, 2023, 8:25am
3
Hi,
Can you try the following?
strResult = String.Join(vbCrLf,dt.AsEnumerable.Select(Function(r) r(0).ToString))
Regards,
Hi @SH_K ,
Try using the Combination of Read Range Workbook
and For Each Row in Datatable
activities as a First Try, you should be able to get the idea and work towards building the same logic for concatenating values to the variable.