I have to cols in a excel file that I want to read and, for each col, I want to write the entries to an arrat var. So these two now becomes:
arrayOfNamesCol = {"engr1", "engr2".........}
arrayOfRoleCol = {"lead","Assoc"............}
I have tried two approaches:
1 .
but I’m getting a null Ref exception.
Attached is my attempt, I’d appreciate help figuring out what I’m doing wrong
readExcelColEntriesToArray.zip (9.6 KB)
@Yomi_Oluwadara
i have tested the workflow which you have shared i didnt see any exception
arrayOfNamesCol=dt_excelContent.AsEnumerable.Select(Function(a) a("Name").ToString).ToArray
or if you want to use for each row in data table activity
just refer the xaml
readExcelColEntriesToArray.zip (10.3 KB)
Thanks, following your logic for the first col. I tried to read and convert the second col, but I got a null ref. Do you know why this might be the case ?
I know the DT has the second col because I outpye the DT
I have re-attached my workflow (main.xaml) kindly help take a look
readExcelColEntriesToArray.zip (12.1 KB)
Hi @Yomi_Oluwadara
arrayOfNames As String[] = dt.AsEnumerable().Select(Function(row) row.Field(Of String)("Name")).ToArray()
arrayOfRole As String[] = dt.AsEnumerable().Select(Function(row) row.Field(Of String)("Role")).ToArray()
Output
Hope it helps!!
@pravallikapaluri
Thanks for your reply. I tied that approach as well (main2.xaml) in the attached. However, it seems I have an empty string
While I try to figure this out, if the reason for this jumps out at you, kindly let me know.
readExcelColEntriesToArray.zip (12.1 KB)
system
(system)
Closed
December 18, 2023, 2:31pm
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.