20
Views
4
Comments
How can i Find Header Row if the excel header row is not in first Row
Application Type
Traditional Web

I need to compare two Excel files based on their common column

  • In the first Excel file, the header row is always located at the top of the sheet (first row).

  • In the second Excel file, the header row can appear anywhere in the sheet — it is not fixed. There might be extra rows above it, such as titles, notes, or blank lines.

Before comparing the data from both files, I must detect which row in the second Excel file contains the actual headers

2016-04-22 00-29-45
Nuno Reis
 
MVP

Hello.

If all the cells match, you can do a quick comparison. with a foreach. If some are different/missing, it will take longer.

Any other feature that may help, like styling?

2024-10-12 12-11-20
Kerollos Adel
Champion

For a task like this, it’s better to create a C# extension to handle the comparison — it’ll be easier and more efficient.


UserImage.jpg
Vijay sundaram

Hi @Sathwik Karamsetty

Using Advanced Excel, there’s a server cell that you can Find by value — you can use that feature and then apply the condition check accordingly. I shared the attachment as well

Thanks!

cell find by value.png
2025-12-03 17-22-41
Lavanya Kamalaguru

Hi @Sathwik Karamsetty ,

  • Read File 2 rows one by one.
  • Detect the header row by checking for expected column names or a pattern matching File 1 headers.
  • Once the header row is found, use it as the starting point to extract and compare data with File.
  • Using an Advanced Excel plugin to read File 2 rows.
  • Implement a loop to scan rows until the header row is detected by matching column names.
  • Then perform your compare logic based on the detected header.

Let me know if you need any help on this! 

Thanks!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.