Skip to main content
Question

How to read CSVs from inside multiple Zip files


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.

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+17
  • 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+49
markatsafe wrote:

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?

 

 


Reply


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