in reply to Re^2: Create CSV file from xlsx file
in thread Create CSV file from xlsx file

xlscat is a perl script (read the links given), have you simple added the lines Tux gave you to your existing script? If so don't. The examples given to you run from the command line, your script is not required.

Replies are listed 'Best First'.
Re^4: Create CSV file from xlsx file
by viji234 (Initiate) on Oct 24, 2013 at 12:05 UTC
    when i ran the command in cmd it gives error as 'xlscat' is not recognized as an internal or external command, operable program or batch file.

      Right click this link and save it, then run it as explained. If you don't have Spreadsheet::Read installed run this from the command line:

      cpan Spreadsheet::Read

      It'll prompt you to install this and other utility scripts.

      Update: see strike out above.

Re^4: Create CSV file from xlsx file
by viji234 (Initiate) on Oct 24, 2013 at 12:06 UTC
    When i ran this command in CMD it gives the below error 'xlscat' is not recognized as an internal or external command, operable program or batch file.

      If you just copied the script, the header line is likely to be "wrong". My version states #!/pro/bin/perl, which is a very unlikely location for your location of the perl binary.

      If you install the scripts using cpan Spreadsheet::Read, it is very likely that the headers are automatically updated to reflect the location of your perl binary.


      Enjoy, Have FUN! H.Merijn
Re^4: Create CSV file from xlsx file
by viji234 (Initiate) on Oct 24, 2013 at 13:38 UTC
    Thank you :) In the xlscat script i removed the #!/pro/bin/perl and added the use Spreadsheet::Read,use Text::CSV_XS and ran the command . it creates the file1.csv file but no records are there in the file and it return the below error
    xlscat -S 1 -C 9-11,21 -c sample.xlsx >file1.csv
    error: 'xlscat' is not recognized as an internal or external command, operable program or batch file.

      This is confusing, are:

      use Spreadsheet::Read; use Text::CSV_XS;

      and

      xlscat -S 1 -C 9-11,21 -c sample.xlsx >file1.csv

      Different scripts? Why do you have use Text::CSV_XS;? Regardless you need to stop trying things at random in the hope they'll work. It's a poor strategy.

      In order to perform the task you need to you do not need to write a script. Do the following steps, in order, don't do anything else:

      1. Install Spreadsheet::Read, from the command prompt:

      cpan Spreadsheet::Read

      It will ask if you want to install xlscat as well as other utilities:

      marto@shemp:~$ cpan Spreadsheet::Read Reading '/home/marto/.cpan/Metadata' Database was generated on Thu, 24 Oct 2013 07:53:02 GMT Running install for module 'Spreadsheet::Read' Running make for H/HM/HMBRAND/Spreadsheet-Read-0.49.tgz Checksum for /home/marto/.cpan/sources/authors/id/H/HM/HMBRAND/Spreads +heet-Read-0.49.tgz ok CPAN.pm: Building H/HM/HMBRAND/Spreadsheet-Read-0.49.tgz Do you want to install 'xlscat' (Convert Spreadsheet to plain text or +CSV) ? [y] y Do you want to install 'ss2tk' (Show a Spreadsheet in Perl/Tk) ? [y] +y Do you want to install 'xls2csv' (Wrapper around xlscat for easy XLS = +> CSV) ? [y] y Checking if your kit is complete... Looks good

      cpan should install any prerequisites required.

      2. run the commands Tux gave you here.

      If you're actually interested in learning how these things work I suggest you spend time reading and understanding the following:

        FYI I uploaded Spreadsheet::Read version 0.50 today which adds the command xlsgrep and supports column names like -C D,F-H,Y,AH. I just checked MetaCPAN, which already shows this new release.

        The documentation includes a new TOOLS section.

        I'm always open to improvement suggestions.


        Enjoy, Have FUN! H.Merijn
Re^4: Create CSV file from xlsx file
by viji234 (Initiate) on Oct 25, 2013 at 06:54 UTC
    Thank you marto:) In windows I am using strawberry-perl 5.18.1.1.

      So did you do what I suggested and download and run the script? When someone asks for specific information please provide it. I asked for the output of 2 commands.

        Yes mart.. I did download and istalled it in my windows then ran the command given by tux. Still i am getting the sam error as xlcat is not recognised internal and external.