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: CSVee

Development and Programming

tpayton's avatar
tpayton
172 posts
17 years ago
tpayton's avatar tpayton

butcher - wow that worked like a charm. Thanks!

       
Bluebloc's avatar
Bluebloc
111 posts
17 years ago
Bluebloc's avatar Bluebloc

Great plugin Daniel. Thanks for sharing it. It’s been really useful.

I wonder if you could help me. I am using the code below to get member info and one member custom field from certain member groups. My problem is that I am getting results from all member groups not just the pipe delimited selected group_ids.

{exp:csvee group_id="1|6|9" query="SELECT m.screen_name, m.username, m.group_id, m.join_date, d.m_field_id_1 FROM exp_members AS m LEFT JOIN exp_member_data AS d ON d.member_id = m.member_id" filename="ggp-subscribers-list.csv"}

Also do you know if its possible to format the display of m.join_date to read as a date rather than the amount of seconds from 1970, the start of the unix epoch, ala “1202917350”?

Thanks

       
Paul B's avatar
Paul B
241 posts
16 years ago
Paul B's avatar Paul B

Wondering if someone can help me out with the CSVee plugin.

I’ve added the following code to a blank template

{exp:csvee query="SELECT member_id, username, screen_name, email FROM exp_members"}

I’m presented with

The following tag has a syntax error: {exp:csvee} Please correct the syntax in your template.

What did I do incorrectly? Or, does this plugin not work with EE1.6.3?

       
tpayton's avatar
tpayton
172 posts
16 years ago
tpayton's avatar tpayton

Paul - Don’t know about your code. But I can confirm that it is working just fine in EE 1.6.3.

       
Paul B's avatar
Paul B
241 posts
16 years ago
Paul B's avatar Paul B

Thanks. I got it working. Great plugin.

       
jejuna's avatar
jejuna
105 posts
16 years ago
jejuna's avatar jejuna

In case someone’s trolling here with the same question posted by Brian M. earlier in this thread regarding multi-select fields in Freeform and export weirdness because each value is on a separate line, I came across that very thing today.

I checked in the Solspace forum, and someone did post an answer on how to fix it in Freeform. It’s very easy and it does work!

In mod.freeform.php search for this: (about line 850 in version 2.6.5)

// If the field is a multi-select field, then handle it as such.

        if ( is_array( $val ) )
        {
            $val = implode( "\n", $val );

            $data[$key] = $REGX->xss_clean($val);
        }
        ...

The fix?

Replace $val = implode( “\n”, $val );

With $val = implode( “,”, $val );

That gives you a comma-separated list of your multiple values, which makes Excel very happy.

       
pushloop's avatar
pushloop
422 posts
16 years ago
pushloop's avatar pushloop

Hey

Great plugin, one of the best and just what I needed! Although, I’m having problems with the character encoding, but I’m not sure if it’s on Excels side.

Opening the .csv-file using a text editor, I get this

“14”,”1”,”23”,”Äpple”,”1”,”André”

resulting in this

14 1 23 Äpple 1 André

Somewhat tells me this might be caused by Excel (2008 version for Mac), but I thought I’d ask anyway 😊

Tnx /André

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

This is utf-8 data being displayed as iso-8859-1. You need a unicode-aware text editor.

       
Mark Terpstra's avatar
Mark Terpstra
205 posts
16 years ago
Mark Terpstra's avatar Mark Terpstra

SOLVED: I renamed the file from .csv to .txt and then copied and pasted the contents into Excel. Worked great.

I’m trying to use CSVee to export FreeForm entries so clients can review survey data in Excel. I’m running into a problem with line breaks in the comment fields. Anyone know of an easy trick to import the CSV into Excel so the line breaks don’t case a jump to a new row in Excel?

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

Daniel, I’ve been starting to use this again, but one question remains.

How do I set a deliminator to nothing? In Excel, I can export as tab separated with no delimiters. That’s what I’m going for here. Figured out how to set the separator to tab. 😊

       
Daniel Walton's avatar
Daniel Walton
553 posts
16 years ago
Daniel Walton's avatar Daniel Walton

Sue, for now you can just make a quick change to the source code;

Find this:

switch(strtolower($custom_delimiter))
        {
            case 'tab'            : $delimiter = "\t"; break;
            case 'space'        : $delimiter = ' '; break;
            case 'double-quote' : $delimiter = '"'; break;
            case 'single-quote' : $delimiter = '\''; break;
            default                : $delimiter = $custom_delimiter; break;
        }

And add another case:

case 'nothing' : $delimiter = ""; break;
       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Thanks, I’ll add it. Wasn’t sure if anyone else had ever wanted that piece of functionality.

       
Daniel Walton's avatar
Daniel Walton
553 posts
16 years ago
Daniel Walton's avatar Daniel Walton

Yes. Essentially the formatting options were added to allow a reasonable amount of flexibility, but nothing quite as flexible as what the query module can achieve, since that accepts and replaces tagdata. I’m beginning to think that a plugin to wrap the query module, with options to insert custom browser headers would offer everything csvee can, plus more, though perhaps not as easy to implement.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

Has anyone had an issue exporting dates in a human-readable format with CSVee? We’re trying to export the entry date, but I know the client won’t know a timestamp from a hole in the wall. I tried something like this (simplified query):

{exp:csvee filename="file.csv" seperator="," query="SELECT date_format(entry_date, '%c/%e/%Y')
 AS formatted_date, fullname, email FROM exp_freeform_entries WHERE entry_id != '' 
AND form_name = 'specificForm' ORDER BY entry_date DESC"}

No matter what I try, the SQL won’t work, and the date field returns empty.

SELECT date_format(entry_date, '%c/%e/%Y') AS formatted_date,
SELECT date_format(entry_date, '%c/%e/%Y') AS entry_date,
SELECT date_format(entry_date, '%c/%e/%Y'),

Is that SQL statement for mySQl 5 only or something? not sure why it wouldn’t work.

       
Daniel Walton's avatar
Daniel Walton
553 posts
16 years ago
Daniel Walton's avatar Daniel Walton
Is that SQL statement for mySQl 5 only or something? not sure why it wouldn’t work.

It will work on 4.1. What server version are you building on, and have you tried the query through another tool? (phpmyadmin/ee query tab)

       
1 2 3 4 5 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.