Skip to main content
Solved

Read multiple Excel file with different starting line

  • September 12, 2024
  • 3 replies
  • 91 views

philippeb
Enthusiast
Forum|alt.badge.img+22

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

redgeographics
Celebrity
Forum|alt.badge.img+62
  • 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+22
  • 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+22
  • 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