Possible quick resolution: I would suggest you go to the webpage where you scrape the datatable and right click on the table header and use “inspect”. You can then within the browser inspect window copy the string value highlighted. This way you know what the actual string Header is within HTML. However, while scrapping data fom a webpage UiPath might also extract some non ASCII characters present in the HTML header. But sometimes this might actually show the decoded string but when UiPath scrapes values it may also pickup encoded strings which may or may not have Non ASCII Characters. You can read this thread on how to avoid such characters
Here is what I would try if the above resolution fails.
How to check for datatable header string?
Use assign activity and clone your extracted datatable. (
SourceTable variable here is of a DataTable type argument in UiPath)
SourceTable = WebScrappedData.Clone (in itself only will copy the headers and not populate any rows to SourceTable)
So you can use
SourceTable = WebScrappedData.AsEnumerable().Take(WebScrappedData.Rows.Count).CopyToDataTable()
Translation: Hey, use the WebScrappedData as an Enumerable and choose all rows within it and copy to a new datatable named
Get the first column name using a Log Message acitivity
Translation: Get me the name of the first column (0 index) in the
SourceTable. Here max index will be the total number of columns.
----- OR Longer Approach --------
Get all the column names from SourceTable (
ColumnNames variable here is an array of strings)
ColumnNames = (From dt In SourceTable.Columns.Cast(Of DataColumn) Select dt.ColumnName).ToArray()
Translation: Use a dummy placeholder name
dt and refer to columns in
SourceTable select the attribute within it named
ColumnName. Since there may be many columns in the
SourceTable, return all of them as an array of strings.
Inspecting what the first column string is using Log Message activity :
Translation: Get me the first element (0 index) in the
ColumnNames array. Here max index will be the total number of columns.
----- Final check -----
4. If the string which you get in the console from Step 3 does not look like “C ID” and C_ID" you know what the real value of the column name is and can use that in your further flows. If it still looks like it does in your WebScrappedData datatable you might want to check
SourceTable.Columns(0).ToString.Length or for Longer Approach -
Since your string looks like “C ID”, ideally it should be of length 4 (number of characters). If its more, you probably have a Non ASCII character in there.