Skip to main content
Question

How to remove duplicates in Excel keeping only one record per ID


gbcfgeo2025
Contributor
Forum|alt.badge.img+1

Hi everyone, quick question: how can I remove the rows from my Excel file where the ID number is duplicated, so that only one record per ID is kept?

9 replies

veschwab
Contributor
Forum|alt.badge.img+13
  • Contributor
  • May 16, 2025

You can maybe use a DuplicateFilter and use the GroupBy function with the first column. It will give you unique values only out of the Unique port :)


gbcfgeo2025
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • May 16, 2025

Thanks for the reply! Another question, how can I add a record at the beginning of the table?


veschwab
Contributor
Forum|alt.badge.img+13
  • Contributor
  • May 16, 2025

Do you want to create a record in the workspace and then add it to your excel table? 

In that case you can use a Creator to create an object and connect it to an AttributeCreator to fill in the information you want and then just connect the streams of your excel table and the newly created object(s).

 

If you have records from another table you want to join in you can just connect the two streams to one, with a junction for example or just directly into the writer, and the records will be appended into one table.


gbcfgeo2025
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • May 16, 2025

Thank you very much! One last question: how can I adjust this text file so that the decimal point of the value at the end of each record is always aligned in the same position? Please have a look at the attached images and file.


veschwab
Contributor
Forum|alt.badge.img+13
  • Contributor
  • May 16, 2025

You can try and use a Column-Aligned Text (CAT) Reader when you read in the data. In the parameters you can change the position of the ruler (red arrow) so that it is between the two data columns and it creates 2 different attributes. Then you can manipulate the data however you want and write it out in your desired format.

 

 


gbcfgeo2025
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • May 16, 2025

I need to do it inside the transformation with a transfomer :(


veschwab
Contributor
Forum|alt.badge.img+13
  • Contributor
  • May 16, 2025

Is the textfile you attached the output of the workspace? In that case, what kind of writer are you using?


gbcfgeo2025
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • May 16, 2025

No, the input file is the Excel file I’m attaching now. I need to convert it into a text file where the decimal point of the elevation value (.) is positioned exactly at column 66 (i.e., column 66 in the text editor).


veschwab
Contributor
Forum|alt.badge.img+13
  • Contributor
  • May 16, 2025

I think it’s because the first “column” has different string lengths so if you pad them into one length it should be easier.

I calculated the max length of the string in the first column and then padded it to that length, so they are all the same length

 

I then split up the other column that contains the number with the dot (.) to see how many characters there are before the .

From this you can pad this string also so that the . will be the 66th character.

 I’ll attach my workspace so you can try it yourself.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings