Skip to main content
Solved

Read multiple Excel file with different starting line

  • September 12, 2024
  • 3 replies
  • 64 views

philippeb
Enthusiast
Forum|alt.badge.img+20

Hi,

I have thousand of Excel files I need to read but all of them have different starting attributes line. Sometimes line 15 or 16 or 17.

(not me who developed that method of working….)

The attributes are all the same for all the files.

Any idea how I could have the Excel Reader to detect the starting line?

Thanks !

Best answer by redgeographics

Are the attribute names always the same? If that’s the case you can read the file once with the regular reader and check lines 15, 16 and 17 with a TestFilter to see if any of them hold the attribute names, then pass them to different FeatureReaders where you’ve set the correct line number for the attribute names.

View original
Did this help you find an answer to your question?

3 replies

redgeographics
Celebrity
Forum|alt.badge.img+50
  • Celebrity
  • Best Answer
  • September 12, 2024

Are the attribute names always the same? If that’s the case you can read the file once with the regular reader and check lines 15, 16 and 17 with a TestFilter to see if any of them hold the attribute names, then pass them to different FeatureReaders where you’ve set the correct line number for the attribute names.


philippeb
Enthusiast
Forum|alt.badge.img+20
  • Author
  • Enthusiast
  • September 12, 2024

Wow that amazing! No idea how FME is doing that, but with the Reader with Field name = None, he recognizes the attribute line in all the files!

I just have to do a Tester to erase the first blank rows.

Thank you!!! I should have thought FME was so smart!

 


philippeb
Enthusiast
Forum|alt.badge.img+20
  • Author
  • Enthusiast
  • September 18, 2024

Hey I understand now how my attributes were added automatically in my CSV, even if my files don’t have the attributes starting at the same line.

First I read my attribute line with one CSV and I add the line to Field Names Line.

After adding the reader to the workbench, I update my Reader and then I modify the same parameter to None.

Then I update my Reader and I use a Tester to skip all the blank lines.

In the end, FME and me are smart! :P


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