Skip to main content
Question

How to read CSVs from inside multiple Zip files

  • April 12, 2017
  • 3 replies
  • 267 views

tim_wood
Contributor
Forum|alt.badge.img+8

I've been trying to read CSVs from inside Zip files in 2017.0 (did some testing with 2016.1 as well). For example, I have 5 Zip files each containing 1 CSV.

If I try C:\\Folder\\**\\*.csv, FME won't even create the Reader (I get errors like "CSV reader: Failed to open file 'C:\\Folder\\**\\*.csv' for reading. Please ensure that the file exists and you have sufficient privileges to read it").

However, I discovered that if I edit the Source CSV File value in the Reader parameters, and manually set it to C:\\Folder\\*.zip\\*.csv then it works. Select Merge Feature Type to get all the CSVs presented as 1 Feature Type.

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

Forum|alt.badge.img+2

Great tip. Some documentation is available to illustrate how to do this with other formats like Shape. You can also use the syntax C:\\Folder\\*.zip\\**\\*.csv, if the zip files are in a nested directory. C:\\Folder\\**\\*.zip will also work, if FME knows what file suffix to expect for that reader.


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • April 14, 2017

If the ZIP files only contain CSV files you do not even have to specify the *.csv:

This worked on two ZIP files, each containing a CSV file with 3 rows.


redgeographics
Celebrity
Forum|alt.badge.img+62

Great tip. Some documentation is available to illustrate how to do this with other formats like Shape. You can also use the syntax C:\\Folder\\*.zip\\**\\*.csv, if the zip files are in a nested directory. C:\\Folder\\**\\*.zip will also work, if FME knows what file suffix to expect for that reader.

This doesn't seem to work with shapefiles that are stored online (https://s3.eu-central-1.amazonaws.com/redgeo-test/Cycling.zip contains 3 shapefiles in the zip root, no problem, https://s3.eu-central-1.amazonaws.com/redgeo-test/Cycling_level2.zip has a subfolder with those 3 shapefiles, can't be read online but can be read if it's stored locally).

 

 

Any ideas on that?