We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: CSVGrab

Development and Programming

webrsm's avatar
webrsm
47 posts
16 years ago
webrsm's avatar webrsm

Cheers

That worked a treat. I was using the url but have changed to an absolute path and it seems to be working

Thanks 😊

       
TheBrad's avatar
TheBrad
48 posts
16 years ago
TheBrad's avatar TheBrad

This looks very promising for an application I have coming up, but is there no way to set the entry date/time and expiry date/time using values from a CSV file? That would be so nifty!

       
Dan Halbert's avatar
Dan Halbert
93 posts
16 years ago
Dan Halbert's avatar Dan Halbert
This looks very promising for an application I have coming up, but is there no way to set the entry date/time and expiry date/time using values from a CSV file?

I have a patched version that does entry and expiration date/time, and a few other minor fixes. With Andrew’s permission I will post it here, or be happy to give it back to him for merging.

Dan

       
hothousegraphix's avatar
hothousegraphix
851 posts
16 years ago
hothousegraphix's avatar hothousegraphix

I am having absolutely no luck with getting the plugin to Grab my data.

Maybe someone will catch something I’m missing. My csv file has been uploaded.

My Grab template looks like:

{exp:csvgrab url="http://www.jrwildkits.com/import_data/2006_FW_b_roster.csv"
    delimiter=","
    weblog="3"
    author_id="1"
    title="1"
    category_group="2"
    category_field="3"
    use="4|5|6|7|8|9|10"
    fields="number|first_name|last_name|age|grade|weight|position"
    unique="title"
} 
{/exp:csvgrab}

I’ve tried both a full path to the csv file as well as a relative path with no success.

Yes, my weblog exists as well as the category group and its categories.

If I’m correct I don’t need the site_id parameter because this site is not part of an MSM install.

Any pointers would be much appreciated.

Thanks

(ah…I’ve also uploaded the xcel file that has created the csv doc, maybe I’ve missed something there???)

       
Dan Halbert's avatar
Dan Halbert
93 posts
16 years ago
Dan Halbert's avatar Dan Halbert

Michael (hothousegraphix):

Try adding

encloser="QUOTE"

to your attributes. CSV’s produced by Excel don’t have them unless necessary. But fgetcsv(), as used by CSVGrab, may fail if that parameter is not specified.

Also add

trace="true"

to get some additional useful output.

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Your first line has the name of the fields in it, so you need to either get rid of it, or tell CSVGrab to ignore that first row.

There is no encloser in your example, so use “” instead.

I just imported 1200 entries over the weekend to a client site using CSVGrab. It does work. 😊 I’d add site_id = 1 as well. It might not be required, but if you use this a more of a howto for the next time you need to use it, you’ll remember to have site_id in a MSM setting.

       
hothousegraphix's avatar
hothousegraphix
851 posts
16 years ago
hothousegraphix's avatar hothousegraphix

Dan, Sue, thanks for the suggestions, I now have it working and everything seems ok.

       
webrsm's avatar
webrsm
47 posts
16 years ago
webrsm's avatar webrsm

Hi

Quick Question before I carry on with project, Can you use this for multiple csv files??? if not can someone point me in the right direction where I can upload excel workbook sheets.

Cheers in advance

L

EDIT

Help as soon as I posted this csv went mad and i keep getting this error:

Notice: Undefined index: id in /home/sites/directfleetsolutions.co.uk/public_html/office/plugins/pi.csvgrab.php on line 331

Notice: Undefined index: id in /home/sites/directfleetsolutions.co.uk/public_html/office/plugins/pi.csvgrab.php on line 332

Notice: Undefined index: format in /home/sites/directfleetsolutions.co.uk/public_html/office/plugins/pi.csvgrab.php on line 332 MySQL ERROR:

Error Number: 1054

WHAT HAVE I DONE???????

END EDIT

       
Visibly Better Marketing's avatar
Visibly Better Marketing
93 posts
16 years ago
Visibly Better Marketing's avatar Visibly Better Marketing

Just been using this to import a product data file from an affiliate network and it’s pretty handy!

2 things I’d like to see (i.e. be prepared to pay for)

1) Put a default value into a field. The site I’m working on draws in data from multiple source files and a field which indicates the source is needed, but not contained in the input files without some pre-processing. Maybe a quote-bound value in the ‘use’ parameter rather than pulling a field from the CSV?

2) Add in data into a relationship field Not trivial I know, but would be incredibly for migrating relational databases into EE. My site has a weblog ‘brands’ created entirely manually, I’m importing data files of products into a ‘products’ weblog which have a ‘brands’ relationship field which link the two together. Being able to import the brand name into the relationship field in the products weblog would be very useful indeed.

If there’s another route to achieving (2), maybe by importing a value into a text field and then some sort of bulk update….?

       
webrsm's avatar
webrsm
47 posts
16 years ago
webrsm's avatar webrsm

Hi

I have started again with the plugin and have followed the docs to a T but I am not outputting anything?

I have put a trace in and nothing is happening.

Can someone help!!!

Here is my code

<pre><code>{exp:csvgrab url=”http://79.170.40.176/directfleetsolutions.co.uk/testy.txt” trace=anything delimiter=”TAB” encloser=”QUOTE” site_id=”2” weblog=”2” category_group=”3” title=”1” category_field=”6” use=”2|3|4|5|7|8|9|10|11” fields=”der|otr|dealer|dis|fund|intro|bus24|bus36|per24|per36” unique=”der</code></pre>” }

i have also just tried url=”testy.txt” as this rectified the problem I was having before, this time though it is not working.

Can someone advise….any help appreciated

Cheers

L

       
Ole Jensen's avatar
Ole Jensen
9 posts
16 years ago
Ole Jensen's avatar Ole Jensen

I struggled a little with this to. I think there is a problem with the Plugin on servers with Php 5. I made a similar installation with EE 1.6.4 one to different servers, one with PHP Version 5.1.6 and one with PHP Version 4.3.9, and with the old version it works.

       
ismschism's avatar
ismschism
5 posts
16 years ago
ismschism's avatar ismschism
If Andrew (or someone) would modify the plugin or make a similar one called something like “CSVUpdate” so it COULD be used for updates, I would be jumping for joy.

I second this request… would be very useful to update rather than duplicate entries. Any chance of this happening?

If not, is there another route to importing/updating multiple weblog entries? Kinda surprising EE doesn’t handle .csv import natively.

       
Visibly Better Marketing's avatar
Visibly Better Marketing
93 posts
16 years ago
Visibly Better Marketing's avatar Visibly Better Marketing

I think there might be a bug relating o the unique parameter, but could be that I’ve misunderstood how it works.

here’s my template:

{exp:csvgrab url="http://mycomain.com/mycsv.csv"
    weblog="2"
    title="10"
    skip="1"
    delimiter="TAB"
    encloser="QUOTE"
    use="11|21|22|32|2"
    unique="title"
    fields="productBody|productLargeImage|productLink|productPrice|productMerchant" 
}

If I run this twice I end up with 2 lots of data in the weblog

If I add an extra value to the unique parameter e.g..

unique="title,productMerchant"

…then it dedupes OK.

I agree that an option to update would be excellent, part of this job is a price comparison section that regularly updates the file. My only other option is to delete the weblog in the admin area and re-run the whole lot every time.

Andrew, could you add that to the quote you gave me? If I’m going to do this I’d rather do it all at once.

       
Ryan 2010's avatar
Ryan 2010
265 posts
16 years ago
Ryan 2010's avatar Ryan 2010

Is it possible to use csvgrab to update existing entries?

       
424contemplator's avatar
424contemplator
2 posts
16 years ago
424contemplator's avatar 424contemplator
This looks very promising for an application I have coming up, but is there no way to set the entry date/time and expiry date/time using values from a CSV file?
I have a patched version that does entry and expiration date/time, and a few other minor fixes. With Andrew’s permission I will post it here, or be happy to give it back to him for merging. Dan

Dan, did you ever work it out with Andrew to allow publishing your code addition here, the one that allows the import of entry and expiry dates (with or without times)? :D :D

It doesn’t seem to be in the code for the latest version of the CSVGrab plugin. Thanks,

Rob

       
First 10 11 12 13 14 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.