Merge Data Table: <target>.Source File Name and <source>.Source File Name have conflicting properties: DataType property mismatch

I want to merge these two data tables but as you can see, their datatype mismatch.

dt_Statistics comes from Read Range Workbook and containing only headers. dt_Report is datatable that I need to pass to dt_Statistics.

In this case, I would prefer dt_Statistics to have String datatype. Is there any way to make sure the type is always String when being read?

image

Hi,

Can you try the following?

dt_StatisticsStr=dt_Report.Clone
dt_StatisticsStr=dt_Statistics.AsEnumerable.Select(Function(r) dt_StatisticsStr.LoadDataRow(r.ItemArray,False)).CopyToDataTable

Then merge dt_Report with dt_StatisticsStr.

Sample20230221-1aL.zip (2.9 KB)

Regards,

1 Like

I unable to follow your method but here’s example data:

Input data (two types): dt_Report1.xlsx (10.5 KB)
image

Output: dt_Statistics.xlsx (9.8 KB)

I need to pass dt_report to its corresponding column in dt_statistics.

The most accurate representative of my current method is read range workbook for dt_statistics (initially empty and only contains header)
image

dt_report is a data lying in the backend with all datatype string. i put in excel for easy reference.
image

while reading an excel the you will automatically get in string format, right?
if you select preserve format option then you will be getting the format you have selected on excel.

Hi @arina ,

Could you let us know how are you retrieving/how is the the dt_Statistics datatable prepared ? Is it by using the Build Datatable Activity ? If so, then maybe changing the type from String to Object to all the columns present in the Build Datatable activity would be another possible solution.

Let us know if this is a possibility for your case.

i thought so too but it didn’t work even after preserves format

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.