Skip to main content
Question

newbie trying to read multiple spreadsheets

  • February 25, 2020
  • 6 replies
  • 241 views

I'm trying to read multiple spreadsheets and write one worksheet from each of them into a single output spreadsheet but am going round in circles...

Input data: I have a parent directory with an unknown number( and names) of subfolders. Each subfolder has a spreadsheet, results.xls. Each spreadsheet has, say, 10 worksheets, ws1, ws2...ws10.

Output: fme needs to search the parent folder to discover the subfolders. Then, for each subfolder, it needs to read the results.xls spreadsheet. A single spreadsheet needs to be written to disk containing worksheet ws5 from each discovered spreadsheet with each worksheet given the name of the subfolder that they came from.

The FME excel reader seems to need to know the name of a spreadsheet in advance, so I used a Path reader to discover the subfolders but passing these to a featureReader doesn't seem to read in the spreadsheets properly.

Any help would be appreciated.

Thanks

Macsmith

6 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • February 25, 2020

Do all the input spreadsheets have the same structure, i.e. sheet names, column names etc.?


  • Author
  • February 25, 2020

Hi Ebygomm,

thanks for the reply. Yes, the speareadsheets all have the same structure, sheetnames and columns, etc.

macsmith


Forum|alt.badge.img+2
  • February 25, 2020

@macsmith You can combine two FME operations to do this.

Select Multiple Files/Folders: this browser allows you to select a folder and then optionally read all subfolders:

Then select Single Merged Feature Type.


  • Author
  • February 25, 2020

thanks Markatsafe.

That looks very interesting. I'll try it out in the morning.

Many thanks

macsmith


  • Author
  • February 26, 2020
markatsafe wrote:

@macsmith You can combine two FME operations to do this.

Select Multiple Files/Folders: this browser allows you to select a folder and then optionally read all subfolders:

Then select Single Merged Feature Type.

Hi Markatsafe,

I've tried your suggestion with mixed results. It does discover and read the various spreadsheets, creating one data set. I tried to figure out how to unscramble the data set as I would like to write out a new spreadsheet with one worksheet from each input spreadsheet.

Using my actual data spreadsheets was too cluttered, so I created 3 simple 2 worksheet example spreadsheets and read them in instead. However, the resulting dataset, as displ[ayed in Visual Preview, still showed collumns from the original data set as well as the new, even when I created a new workspace and tried again.

I then completely exited FME and restarted with a fresh workspace. That worked and all the data from the 3 simple spreadsheets was visible in Visual Preview. However, in re-running the workspace, Visual Preview now only displays data from the first of the three spreadsheets. Re-running makes no difference.

So I'm a bit puzzled.

macsmith


  • Author
  • February 28, 2020

I've tried the suggestion with mixed results. It does discover and read the various spreadsheets, creating one data set. I tried to figure out how to unscramble the data set as I would like to write out a new spreadsheet with one worksheet from each input spreadsheet.

Using my actual data spreadsheets was too cluttered, so I created 3 simple 2 worksheet example spreadsheets and read them in instead. However, the resulting dataset, as displ[ayed in Visual Preview, still showed collumns from the original data set as well as the new, even when I created a new workspace and tried again.

I then completely exited FME and restarted with a fresh workspace. That worked and all the data from the 3 simple spreadsheets was visible in Visual Preview. However, in re-running the workspace, Visual Preview now only displays data from the first of the three spreadsheets. Re-running makes no difference.

So I'm a bit puzzled.

macsmith


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