[mod] Small hack to make CSV import work (for me at least)

3rd party code for phpList

Postby gilsurf » 1:21pm, Thu 08 Jun, 2006

It is currently possible to have multiple selections from a value list (series of checkboxes in 2.10.2

Now, how to get them in. I can get them out, but not in. :(
gilsurf
PL Geek
 
Posts: 56
Joined: 12:23pm, Tue 28 Feb, 2006

Postby gilsurf » 2:28pm, Thu 08 Jun, 2006

It is an attribute (type=checkbox-group) with 6 control values. Does that make sense?
gilsurf
PL Geek
 
Posts: 56
Joined: 12:23pm, Tue 28 Feb, 2006

Postby shumisha » 2:42pm, Thu 08 Jun, 2006

Sorry, I missed it. I have found this type now, so I understand.

The only advice I can give you now would be to switch to a csv file. If you follow the beginning of this post, you will find a modified version of importcsv.php. If you use this, and supply a csv file, it has worked for me for all other type of fields.
The file format must be :

"Email","Send this user HTML emails","First Name","Last Name,"VI Montessori Parent","Age Level"
"new@ansano.com","1","New","Anspacher","Yes","La Casa; Primary; Lower Elementary"

I have also supplied an Excel macro to make such files from Excel
If it does not work, then there is another bug in the import function, and we would have to look into the code to find it, but I don't have the time to do this rapidly :(
shumisha
PL Geek
 
Posts: 82
Joined: 8:06am, Tue 04 Apr, 2006

Postby gilsurf » 3:11pm, Thu 08 Jun, 2006

So, the only way to get such an import is to replace the import function doc and do a special export from excel as csv? ***SPAM***! :x

And, Ithougt there were issues with CSV imports :?:

So, I guess I am off to try the fix noted above.
gilsurf
PL Geek
 
Posts: 56
Joined: 12:23pm, Tue 28 Feb, 2006

Postby shumisha » 3:18pm, Thu 08 Jun, 2006

There were issues with CSV import, but the version I proposed seem to fix most of them.

Also, please do not "save as CSV" from Excel, the file will not be correct. Use the macro supplied in this post instead.

Last thing : this is a suggestion ! I don't know if it is going to work !
shumisha
PL Geek
 
Posts: 82
Joined: 8:06am, Tue 04 Apr, 2006

Postby gilsurf » 1:07am, Fri 09 Jun, 2006

Ok, I gave it a try and there seems to be an issue or I am not doing it correctly. The files you uploaded seem for upload option 1 (all attributes the same). Each of my records has different attributes. I tried naming it as option 2, but that failed as well. I tried an import with the hack file named as option 1 and it did not work either.

The excel macro worked fine.

Any ideas?
gilsurf
PL Geek
 
Posts: 56
Joined: 12:23pm, Tue 28 Feb, 2006

Postby shumisha » 7:23am, Fri 09 Jun, 2006

Morning,

Actually I uploaded files for both ways of importing :

To use the first option, import emails with different values for attributes, I have to apply the same fix to another file. In this case, /lists/admin/import2.php is used, which in turn requires /lists/admin/commonlib/importcsv.php


So you have to replace importcsv.php as well as import1.php.
shumisha
PL Geek
 
Posts: 82
Joined: 8:06am, Tue 04 Apr, 2006

Postby gilsurf » 11:00am, Fri 09 Jun, 2006

The 1st option (import w/different values for attributes) uses import2.php (that makes sense, 1st option is #2... anyway). I only found import1.php (same values for attributes). Am I missing something? File somewhere else?

Yes, I did replace the importcsv.php file with yours.

So, where is import2.php?

Thanks for all your assistance!

Where are the developers on this?
gilsurf
PL Geek
 
Posts: 56
Joined: 12:23pm, Tue 28 Feb, 2006

Postby shumisha » 12:15pm, Fri 09 Jun, 2006

If I remember well, import2.php does almost nothing, but include commonlib/importcsv.php

Don't ask why !
shumisha
PL Geek
 
Posts: 82
Joined: 8:06am, Tue 04 Apr, 2006

Postby gilsurf » 12:42pm, Fri 09 Jun, 2006

So, replace upload1.php with your file and the same for importcsv.php (in their correct places and then try to import the custom csv file? Set delim to a comma?
gilsurf
PL Geek
 
Posts: 56
Joined: 12:23pm, Tue 28 Feb, 2006

Postby shumisha » 12:58pm, Fri 09 Jun, 2006

Yes :

1 - replace importcsv.php in directory your_install_dir/lists/admin/commonlib/pages/

2 - replace import1.php in /your_install_dir/lists/admin/

3 - create a csv file. When importing, select comma as a delimiter (if you used comma a a delimiter in your CSV file. You could use something else).
Scheme is as follow :

Code: Select all
"Email","Send this user HTML emails","First Name","Last Name,"VI Montessori Parent","Age Level"
"new@ansano.com","1","New","Anspacher","Yes","La Casa; Primary; Lower Elementary"


Also, I would suggest you do not use spaces or too long names as attibutes ID. Just in case, you could change "VI Montessori Parent" to "MONTE" for example !
shumisha
PL Geek
 
Posts: 82
Joined: 8:06am, Tue 04 Apr, 2006

Postby mattjabs » 10:09pm, Wed 18 Apr, 2007

I was getting the error, "Fatal Error: Cannot find column with email, please make sure the column is called "email" and not eg e-mail."

No matter what I did I couldn't get around it...then finally I did!

Here's what I did...

1. download the two .zip files on this post: forums[DOT]phplist[DOT]com/viewtopic[DOT]php?p=16266#16266 and apply them. PS...you have to be registered & logged in to see the .zip files.

2. When importing the .csv file, in the field marked "Field Delimiter: (default is TAB)" you need to put a comma in that field, not the word comma, but an actual "," (without the quotes).

If you follow this, it should import. Mine did!
mattjabs
phpList newbie
 
Posts: 3
Joined: 8:57pm, Wed 18 Apr, 2007

Postby shumisha » 5:47am, Thu 19 Apr, 2007

Hi there,

Yes, that's what I meant when saying "...When importing, select comma as a delimiter..." . Thanks for your more detailed instructions.

All the best
shumisha
PL Geek
 
Posts: 82
Joined: 8:06am, Tue 04 Apr, 2006

Postby batman(seeAlso:Robin) » 3:12pm, Wed 30 May, 2007

Hey there,

Here's how I got it to work, importing from a vCard. All I got were the email addresses and that's all I wanted. :)

First I converted vCard to csv using this online tool...

vcfconvert (google it -sorry they won't let me post URLs)

using the option "Gmail(CSV)"

Then I opened up the resulting csv file in this program:

csved (google it)

and used "repair csv file" and also removed duplicates. Save the file.

NEXT, I uploaded the csv file (the one I saved out of csvEd) into Google "Documents and Spreadsheets" and Deleted ALL the columns except the one marked with "email" at the top. Make sure it reads "email" and not "e-mail" or whatever else.

NEXT, in "Google Documents and Spreadsheets" I clicked File>Export CSV (sheet only). That will open up a nice clean page in your browser with a simple list of addresses. Cut and paste the list into a text file and save it as a csv file.

And then it's just manage-users>import-users, click "import emails with different values for attributes" and away you go.

And that's how it works and it works for REAL! :)
batman(seeAlso:Robin)
phpList newbie
 
Posts: 1
Joined: 12:51pm, Wed 30 May, 2007

Postby gilsurf » 3:45am, Mon 27 Aug, 2007

I just came back to this after a year of using the list without a multiple checkbox attribute.

Now, we really need to use this type of attribute and I need to import users for this. I have re-read through this thread and done all the steps in 2.10.3 but have not found success. Each time, the SQL database returns an error at the multiple value code:
Code: Select all
"boyle; summer; matthews"
in an import line of:
Code: Select all
"Email","Send this user HTML emails","First Name","Last Name","salutation","class"
"kaia@email.com","1","Kaia","Smith","Kaia","boyle; summer; matthews"


I even tried changing the ; to a comma and a space. The export is a ; (semi-colon) but this will not import.

Any ideas? ASAP? :?

Thanks!
gilsurf
PL Geek
 
Posts: 56
Joined: 12:23pm, Tue 28 Feb, 2006

PreviousNext

Return to Contributions: Plug-ins, Add-ons, Mods

Who is online

Users browsing this forum: No registered users and 1 guest