It is currently Wed Sep 08, 2010 9:27 pm

Change CSV Delimiter ',' for ';'

A forum for the users of EasyTable. This is a community forum for discussion on using the component. This forum is not monitored by CPPL staff.

If you need active support you can get it from our subscribers forum. Access to subscriber forums requires a current support subscription for the product you want support for.

Change CSV Delimiter ',' for ';'

Postby sh4 » Wed Mar 24, 2010 12:25 am

Hello!!

The title is descriptive :P, i'm looking for a workarround to this, in my regional settings, MS Excel by default creates the CSV files using ';' instead of ',' and do not read correctly CSV files using ',' separator. Considering easytable gives an error when i try to read CSV files using ';' separator... Is there any solution easy solution to this, without having to write some php code for converting ';' to ',' before loading the data into easytable?

I'm a bit noob into php programming and it would take me too long, heh.

Thanks!
sh4
Grasshopper
 
Posts: 12
Joined: Wed Mar 24, 2010 12:20 am

Re: Change CSV Delimiter ',' for ';'

Postby support » Wed Mar 24, 2010 8:56 am

Hi sh4,
EasyTable for J! doesn't support different delimiters.

EasyTable Pro for J! will support a variety of delimiters in an upcoming version.

Having said that, you may want to try changing the contoller file:

/administrator/components/com_easytable/controllers/easytable.php

at line 234:
Code: Select all
$handle = fopen($filename, "r");
while (($data = fgetcsv($handle)) !== FALSE)
{


to this:

Code: Select all
$handle = fopen($filename, "r");
while (($data = fgetcsv($handle, 0, ';' )) !== FALSE)
{


Having said that you should be aware of two things:
  1. this change hasn't been tested at all
  2. once you make this change CSV files with comma's won't import.
  3. :!: you do this at your own risk :!:
    • if it blows up your computer/webserver/the internet we can't help you :-)

Ok, that was 3 things - hope that helps (and doesn't blow anything up).
Support @ Craig Phillips Pty Ltd
Contact Us | Twitter | Website
support
Master
 
Posts: 112
Joined: Thu Jan 21, 2010 10:25 am
Location: NSW, Australia

Re: Change CSV Delimiter ',' for ';'

Postby sh4 » Thu Mar 25, 2010 9:34 pm

Thanks craig for providing this exceptional extension and even support for free.

I will try this ;)
sh4
Grasshopper
 
Posts: 12
Joined: Wed Mar 24, 2010 12:20 am

Re: Change CSV Delimiter ',' for ';'

Postby UncleTaz » Fri May 28, 2010 6:09 pm

Hi sh4,

You could also leave the code alone, and edit the csv file:

- open it in notepad
- click on edit->replace
- search for ; and replace it with ,

You are done 8-)
UncleTaz
Newbie
 
Posts: 1
Joined: Fri May 28, 2010 6:07 pm

Re: Change CSV Delimiter ',' for ';'

Postby sh4 » Wed Jun 30, 2010 1:43 am

UncleTaz wrote:Hi sh4,

You could also leave the code alone, and edit the csv file:

- open it in notepad
- click on edit->replace
- search for ; and replace it with ,

You are done 8-)


Thanks for the advice UncleTaz but craig's code modification worked fine, and now, i have no need to do that in order to import csv's :mrgreen:

Thanks.
sh4
Grasshopper
 
Posts: 12
Joined: Wed Mar 24, 2010 12:20 am


Return to EasyTable Community Forum

Who is online

Users browsing this forum: No registered users and 1 guest

User Menu

Login Form

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 19 on Fri Apr 09, 2010 3:16 pm

Users browsing this forum: No registered users and 1 guest