importcsv

Module to import rows from CSV file to database
28 followers

ImportCSV is used for load positions from CSV file to database.

Import occurs in three steps:

  1. Upload file;
  2. Select delimiter and table;
  3. Select mode and columns in table.

Module has 3 modes:

  1. Insert all - Add all rows;
  2. Insert new - Add new rows. Old rows remain unchanged;
  3. Insert new and replace old - Add new rows. Old rows replace.

All parameters of the previous imports are saved in a special .php file in upload folder.

Requirements

Yii 1.1

Usage

1) Copy all the 'importcsv' folder under /protected/modules

2) Register this module in /protected/config/main.php

'modules'=>array(
        .........
        'importcsv'=>array(
            'path'=>'upload/importCsv/', // path to folder for saving csv file and file with import params
        ),
        ......
    ),

3) Do not forget to set permissions for directory 'path'

4) The module is available at http://yourproject/importcsv or http://yourproject/index.php?r=importcsv (depends from path settings)

Total 20 comments

#8264 report it
ardem at 2012/05/22 04:55am
Re

Hi, paskuale

No, it's correct. It's entirely up to your path settings in protected/confing/main.php

#8263 report it
paskuale at 2012/05/22 04:08am
call module ...

Hi for me module is available on http://127.0.0.1/myproject/index.php?r=importcsv

This guide wrote : 4) The module is available at http://yourproject/importcsv (is incorrect?)

thanks

#6844 report it
guoliang86 at 2012/02/09 02:01am
Not Found

When i try to upload a csv file, i gotten a msg which says:

The requested URL /importcsv/default/upload was not found on this server.

this error seems to be coming from the download.js

any solution to this?

#5799 report it
kevintan at 2011/11/14 06:37am
Re:Problem to make this extension work

Hello tad,

Thank you for helping me with this extension. If you have time can you please help me with it because I really can't make it work. I downloaded the file then created a modules folder in the protected folder. After that I put the importcsv folder inside the modules then I followed what you told me to create for the path but still I can't access it what is the right code or url for it? If you have time can you please guide me with the steps in making this extension work? Thanks. I am a student right now and don't have much exp with this thanks a lot but we need it for our system. Sorry for the trouble. Sorry if I am asking too much questions God bless :)

Kevin

#5794 report it
tad at 2011/11/14 03:50am
Re:Problem to make this extension work

Hi Kevin,

The path should be the url of the folder where the uploaded file should be placed. I had created a upload/importCsv folder inside the Module/ImportCsv folder and had mentioned this path there. Hope this would solve your problem.

Tad

#5784 report it
kevintan at 2011/11/13 09:01am
Problem making this extension work

Hello,

I also want to use this extension but actually I can't make it work. I am new to yii so I am still quite confused with the codes. Well can someone help me to make it work, I followed the steps but I am not quite sure with step 2 what does the path do or what must be the right path I think I am doing it wrong? http://localhost/gxi_sales/gxi_sales/index.php/importcsv/default is the url I use is it wrong? thanks sorry for asking these questions hopefully some one could help. God bless!

Kevin

#5435 report it
ardem at 2011/10/12 03:07am
RE2: Problem installing this extension

Hi, Tad.

I wanted to answer to you, but you already solved your problem yourself.)

#5431 report it
tad at 2011/10/12 02:18am
RE: Problem installing this extension

Thanks Artem, I could resolve my problem. Had not set the url in path variable properly. Its a great extension.

Thanks

#5417 report it
ardem at 2011/10/10 03:46pm
RE: Problem installing this extension

Hi, Tad.

You must download this module into protected/modules. No protected/models.

#5416 report it
tad at 2011/10/10 03:38pm
Problem installing this extension

Hi

I am interested in using this extension in my application but getting some errors. I have downloaded the folder in protected/models as stated. In main.php, what should be the path?

Thanks

#4986 report it
ardem at 2011/09/04 04:44am
Re: Exclude table

Hi, giunz.

This list is formed in method "tableColumns" (/protected/modules/importcsv/models/ImportCsv.php). You can exclude this table from array, for example, in "/protected/modules/importcsv/views/default/secondResult.php" str. 35.

#4984 report it
giunz at 2011/09/03 11:40am
Exclude table

Hello, In my database I have a table users where I keep usernames and passwords.Is there a way to exclude that table from the list that gets loaded?Thnx

#4864 report it
MtlMike at 2011/08/22 08:16pm
documentation and examples please

Thanks

#4402 report it
artur_oliveira at 2011/07/05 05:47pm
Handling of relations

Hi

The idea looks very nice but i haven't tried it yet (Sorry!!) but i'm wondering how does it handle data from related tables ?

Thanks in advance

#4326 report it
sieppl at 2011/06/26 05:47am
Problem with keys?

Hi!

I have an CVS file without a primary key and would like to import the data sets to a table with auto-incremented primary keys (Insert all from cvs into a blank table).

This I leave table pole "id" unassigned. There is no error message after import, but no rows are imported at all.

Is that possible or do I have to introduce an id column to the cvs file?

Sebastian

#4323 report it
sieppl at 2011/06/26 04:28am
Better MVC

Thanks for your contribution to Yii! I recommend removing the logic from secondResult.php and the other views and move it to a model.

#3469 report it
Eliovir at 2011/04/14 07:32am
Suggestions

Hi,

this is a nice interface

I've got some suggestions to improve your model ImportCsv.

  • why do you use a CFormModel?
  • use quoteTableName()
  • use bindParam()
  • add a CDbConnection property (or set a getDbConnection() method) to allow using another database
  • to not show the full path of the file, only the base name
#3302 report it
ortenheim at 2011/04/01 07:40am
thank you

it works now :)

#3301 report it
ardem at 2011/04/01 07:36am
Re: delimiter error

Hi, ortenheim.

I corrected this error. Download new version please.

#3298 report it
ortenheim at 2011/04/01 03:51am
delimiter error

hi i get a delimiter error when installed the module. i have made the folder 777...

Undefined variable: delimiter protected/modules/importcsv/controllers/DefaultController.php(268)

267 $this->render('index', array( 268 'delimiter'=>$delimiter, 269 'tablesArray'=>$tablesArray, 270 ));

how can i fix this problem? (i am using yii 1.1.7)

Leave a comment

Please to leave your comment.

Create extension
Downloads