Changes

Jump to navigation Jump to search
Easier way to download big CSV exports
Line 6: Line 6:     
=== Looking for a selection of products? ===
 
=== Looking for a selection of products? ===
Then use the advanced search. The Open Food Facts advanced search feature allows to download selections of the data. See: https://world.openfoodfacts.org/cgi/search.pl
+
Then use '''the advanced search'''. The Open Food Facts advanced search feature allows to download selections of the data. See: https://world.openfoodfacts.org/cgi/search.pl
    
When your search is done, you will be able to download the selection in '''CSV or Excel format''', just give a try!
 
When your search is done, you will be able to download the selection in '''CSV or Excel format''', just give a try!
 +
 +
Do notice you can download up to 10,000 results only. If you need to download more results you have to use some other methods described below.
    
=== Looking for the whole database? ===
 
=== Looking for the whole database? ===
 
The whole database can be downloaded at https://world.openfoodfacts.org/data
 
The whole database can be downloaded at https://world.openfoodfacts.org/data
   −
It's very big. Open Food Facts hosts more than 2,600,000 products (as of October 2022). So you will probably need skills to reuse the data.
+
It's very big. Open Food Facts hosts more than 2,800,000 products (as of April 2023). So you will probably need skills to reuse the data.
    
You'll be able to find here different kinds of data.
 
You'll be able to find here different kinds of data.
Line 264: Line 266:  
  where countries_en like "%germany%" and unique_scans_n is not null
 
  where countries_en like "%germany%" and unique_scans_n is not null
 
  order by unique_scans_n desc
 
  order by unique_scans_n desc
  -- the limit here displays 20 results; remove it or comment it with "--" when you build your CSV export
+
  -- the limit here displays 20 results; the link "CSV without limit" below allow you to download all the data without limit
 
  limit 20
 
  limit 20
<nowiki>https://mirabelle.openfoodfacts.org/products?sql=--+Products+from+Germany+that+have+been+scanned+at+least+one+time%0D%0Aselect+code%2C+product_name+from+%5Ball%5D%0D%0Awhere+countries_en+like+%22%25germany%25%22+and+unique_scans_n+is+not+null%0D%0Aorder+by+unique_scans_n+desc%0D%0A--+the+limit+here+displays+20+results%3B+remove+it+or+comment+it+with+%22--%22+when+you+build+your+CSV+export%0D%0Alimit+20</nowiki>
+
https://mirabelle.openfoodfacts.org/products?sql=--+Products+from+Germany+that+have+been+scanned+at+least+one+time%0D%0Aselect+code%2C+product_name+from+%5Ball%5D%0D%0Awhere+countries_en+like+%22%25germany%25%22+and+unique_scans_n+is+not+null%0D%0Aorder+by+unique_scans_n+desc%0D%0A--+the+limit+here+displays+20+results%3B+the+link+%22CSV+without+limit%22+below+allows+to+download+all+the+data+without+limit%0D%0Alimit+20
 
  −
'''2 -- Copy "CSV" link on the result page.'''
  −
 
  −
'''3 -- If necessary, edit the link to remove the "limit+20" limit to get all the products.'''
     −
Eg. (don't click this link if you don't want to get 90,000+ products) <nowiki>https://mirabelle.openfoodfacts.org/products.csv?sql=--+Products+from+Germany+that+have+been+scanned+at+least+one+time%0D%0Aselect+code%2C+product_name+from+%5Ball%5D%0D%0Awhere+countries_en+like+%22%25germany%25%22+and+unique_scans_n+is+not+null%0D%0Aorder+by+unique_scans_n+desc%0D%0A--+the+limit+here+displays+20+results%3B+remove+it+or+comment+it+with+%22--%22+when+you+build+your+CSV+export%0D%0A&_size=max</nowiki>
+
'''2 -- Click on the link "CSV without limit"'''
   −
Now you can use this link to download the CSV with your favourite tool (wget, curl, web browser, etc.).
+
Maybe you have to wait several seconds. It will download a product.csv file.

Navigation menu