Get the App
SLTechnology News&Howtos  ›  Development  › 

How to remove duplicate lines from a file by EXCEL

Shulou Source: shulou.com Published: 2022-06-03 17:41:01 09月18日 Update

This article introduces the knowledge of "how to remove duplicate lines in a file by EXCEL". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In the EXCEL data file, if several rows with equal values are called duplicate rows, how do you delete the redundant duplicate rows and leave only one row?

If there is little data, only a few dozen rows of data, then manual deletion is also possible. If the amount of data is very large, manual processing will be very troublesome, and it will often get stuck with the VBA that comes with Excel.

Write your own program to achieve it? It is also feasible, but first you have to read the contents of the EXCEL file into a dataset object, then compare whether it is a duplicate row line by line with a double loop, delete the duplicate row and then output it to a new EXCEL file, which is a lot of work to write code. And because the format of the EXCEL file is different and the fields to be compared are different, the program written is not universal, so you need to rewrite the program next time.

If you use the aggregator SPL to remove duplicate lines, it's easy, with only three lines of code.

For example, the following EXCEL file:

If you press Col1, Col2, Col3 to remove duplicate lines, write the SPL script as follows:

A1=file ("test.xlsx") .xlsimport@t () 2=A1.group@1 (Col1,Col2,Col3) 3=file ("test1.xlsx") .xlsexport @ t (A2)

SPL can also easily handle the following EXCEL requirements:

1. Read EXCEL files in free format, crosstab, master and child tables, etc.

2. Export and append the data to the EXCEL file, and output the EXCEL file in a preset exquisite format.

3. Read and write EXCEL files with a large amount of data

4. Merge and split EXCEL files

This is the end of the content of "how to remove duplicate lines in a file by EXCEL". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: File data format content program processing output code manual more knowledge different feasible practical big same beautiful free learned next Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Shulou Technology NVidia macOS Huawei