in reply to Re^4: Create CSV file from xlsx file
in thread Create CSV file from xlsx 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:

Replies are listed 'Best First'.
Re^6: Create CSV file from xlsx file
by Tux (Canon) on Oct 24, 2013 at 14:34 UTC

    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
      thank you .. Again i installed Spreadsheet::Read as mentioned by you and mart. when i ran the command its giving the same error.
      error: 'xlscat' is not recognized as an internal or external command,operable + program or batch file.
      xlscat -S 1 -C 9-11,21 -c sample.xlsx >file1.csv

        If you installed the module and answered yes to installing these tools then something is wrong with your setup. Perhaps your path is wrong in that it's missing. I'll come back to this. These tools are perl scripts, you can download them and run them as you would any other perl script. Save this link as xlscat, given that I suspect that your setup may be messed up run the commands in the same location as you saved the file above:

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

        Which version of Perl do you have installed? The output of the following would be helpful in further diagnosing the issue above:

        c:\path c:\perl -V

        If you paste the output of these commands into a reply here (remember the code tags please) we can work towards resolving the problem.