Column 'Last Name' does not belong to table

Unable to retrieve the Last Name column form a excel spreadsheet. All other columns are read and then entered into a form but for some reason it will not accept the Last Name column. Any thoughts?

Thanks

John

19.5.0+Branch.master.Sha.a03bc4726ca82b7bb3addb0d04106dc150b31fba

Source: Type Into ‘INPUT DcrJd’

Message: Column ‘Last Name’ does not belong to table .

Exception Type: System.ArgumentException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.ArgumentException: Column ‘Last Name’ does not belong to table .
at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

1 Like

Check in excel file for the last name column if it has extra space at the end or in the beginning.

1 Like

@jmcentee1488

Put ColumnName like this [Last Name] and then try.

@jmcentee1488 just check whether you are using the column name which is belongs to that table,if that belongs to that table make sure there are no spaces before the column name in that excel file.

Thanks,

Everything looks good. No space, etc.

First Name Last Name Company Name Role in Company Address Email Phone Number
John Smith IT Solutions Analyst 98 North Road jsmith@itsolutions.co.uk 40716543298
Jane Dorsey MediCare Medical Engineer 11 Crown Street jdorsey@mc.com 40791345621
Albert Kipling Waterfront Accountant 22 Guild Street kipling@waterfront.com 40735416854
Michael Robertson MediCare IT Specialist 17 Farburn Terrace mrobertson@mc.com 40733652145
Doug Derrick Timepath Inc. Analyst 99 Shire Oak Road dderrick@timepath.co.uk 40799885412
Jessie Marlowe Aperture Inc. Scientist 27 Cheshire Street jmarlowe@aperture.us 40733154268
Stan Hamm Sugarwell Advisor 10 Dam Road shamm@sugarwell.org 40712462257
Michelle Norton Aperture Inc. Scientist 13 White Rabbit Street mnorton@aperture.us 40731254562
Stacy Shelby TechDev HR Manager 19 Pineapple Boulevard sshelby@techdev.com 40741785214
Lara Palmer Timepath Inc. Programmer 87 Orange Street lpalmer@timepath.co.uk 40731653845
1 Like

@jmcentee1488

Could you please share xaml and Excel file with me. Will check and update you.

Try this …first read the excel sheet then in for each try Datatable.Columns and after that display item in log or msgBox. It will show all the columns name available in you Excel Sheet.

Hi buddy @jmcentee1488

Welcome to UiPath community

Fine we can either mention with column index in the type into field as input
Like this
row(1).Tostring
Where 1 index mention the column Last Name and usually the column index starts with 0

Or to find the column name exactly
Use simply a write line like this
Yourdatatablename.Columns(0).ColumnName.ToString
This will print the column name of that column in write line Activity…
Well we can use that buddy…

Hope this would help you
Cheers @jmcentee1488

1 Like

Thank you. row(1).ToString worked.

Where do you think the issue is with the column name? is it with Excel or UIPath?

Thanks

1 Like

If row(1) worked then the table has read in fine so the only issue could have been:

  1. You didn’t read the table in with headers enabled in properties
  2. The column header is not “Last Name” and either contains spaces at the start or end or maybe a newline after Last to split it onto two lines
1 Like

Fine lets check what is the name of that column using a write line activity
–put this in the write line activity that would output the column name in the output panel
Yourdatatablename.Columns(0).ColumnName.ToString
to check the length of the columnname
Yourdatatablename.Columns(0).ColumnName.ToString.Length
actually it should be 9
check whether it is 9 or not
we will come to know the issue buddy
Cheers @jmcentee1488

any issues still buddy
Cheers @jmcentee1488

Thanks,

I went with row(1).ToString and that seem fairly stable. I still am trying to understand why it does not see the colname “Last Name”… As you can imagine this issue could pop up other places and I need to understand cause.

thanks

1 Like

Fine @jmcentee1488
There can 2 reasons buddy

  1. either the column name must have space in front or at back to name “Last Name”
    like this " Last Name" or "Last Name ", which might not let the bot to the recognize the column name
  2. The term Last Name must of two lines either, i hope it wont be but this can be checked only with this buddy
    Yourdatatablename.Columns(1).ColumnName.ToString
    where here 1 denotes the column “Last Name”, we can check by just writing this in write line activity to check the actual issue, which would surely help us to solve the issue

Thats all buddy, these things must be the reason…else would be fine
Cheers @jmcentee1488

1 Like

Yes, Write Line gave me “Last Name” in the output.

if possible can i have a screenshot of the write line output, just to check whether any space occurs or not
Cheers @jmcentee1488

This is from the log.

BlankProcess24 execution started
11:45:32.0000 => [INFO] [UiPath.Studio.Shared.Logging.OutputLogger] [40] Last Name
11:45:32.0000 => [ERROR] [UiPath.Studio.Shared.Logging.OutputLogger] [25] Type Into ‘INPUT Last Name’: Column ‘Last Name’ does not belong to table .
11:45:32.0000 => [INFO] [UiPath.Studio.Shared.Logging.OutputLogger] [22] BlankProcess24 execution ended in: 00:00:00

1 Like

I still wonder why it didn’t
fine lets check the length of the string “Last Name” and it should be 9
Try with this buddy @jmcentee1488
Yourdatatablename.Columns(1).ColumnName.ToString.Length.ToString

It will not let me covert int to TS.
Compiler error(s) encountered processing expression “Names.Columns(1).ColumnName.ToString.Length”.
Option Strict On disallows implicit conversions from ‘Integer’ to ‘String’.
[/quote]

1 Like