Skip to main content
Solved

Loop over a folder's items (i.e. excel files)


I have several excel sheets that have same/similar structures, although some are missing their header names. I can migrate them to SQL Server one-by-one using FME. But I want to loop over the contents of my folder (i.e the excel files) and migrate them all in one go. How do I loop over them? I want to use the same header names for the files missing them as the ones that have them - the header names.

Best answer by itay

Hi @mahdy1989,

I would also use the Directory and File path reader as @erik_jan suggests, however I would use a FeatureWriter in the same workspace to create the tables instead of a second workspace.

Hoet this helps.

Itay

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

3 replies

  • Author
  • March 27, 2019

for example,

abc1.xls --> dbo.abc1

abc2.xlsx --> dbo.abc2

...

abc25.xls --> dbo.abc25

abc26.xls --> dbo.abc26

abc27.xlsx --> dbo.abc27


erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • March 27, 2019

Not a complete answer, but a good start:

Have a look at the "Directory and File path" reader.

That reader returns the names of the files in the folder you point it to.

Then use the file names to crate a table name.

Use a WorkspaceRunner to kick off your workspace that reads and writes one file.

Use published parameters to pass the file and table name to that workspace.

Hope this helps.


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • Best Answer
  • March 27, 2019

Hi @mahdy1989,

I would also use the Directory and File path reader as @erik_jan suggests, however I would use a FeatureWriter in the same workspace to create the tables instead of a second workspace.

Hoet this helps.

Itay


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