NAME

xls2csv - A script that recodes a spreadsheet's charset and saves as CSV.

DESCRIPTION

This script will recode a spreadsheet into a different character set and output the recoded data as a csv file.

The script came about after many headaches from dealing with Excel spreadsheets from clients that were being received in various character sets.

OPTIONS

-x     : filename of the source spreadsheet
-b     : the character set the source spreadsheet is in (before)
-c     : the filename to save the generated csv file as
-a     : the character set the csv file should be converted to (after)
-q     : quiet mode
-s     : print a list of supported character sets
-h     : print help message
-v     : get version information
-W     : list worksheets in the spreadsheet specified by -x
-w     : specify the worksheet name to convert (defaults to the first worksheet)

EXAMPLE USAGE

The following example will convert a spreadsheet that is in the WINDOWS-1252 character set (WinLatin1) and save it as a csv file in the UTF-8 character set.

xls2csv -x "1252spreadsheet.xls" -b WINDOWS-1252 -c "ut8csvfile.csv" -a UTF-8

This example with convert the worksheet named "Users" in the given spreadsheet.

xls2csv -x "multi_worksheet_spreadsheet.xls" -w "Users" -c "users.csv" 

NOTES

The spreadsheet's charset (-b) will default to UTF-8 if not set.

If the csv's charset (-a) is not set, the CSV file will be created using the same charset as the spreadsheet.

REQUIRED MODULES

This script requires the following modules:

Locale::Recode
Unicode::Map
Spreadsheet::ParseExcel
Spreadsheet::ParseExcel::FmtUnicode (should be included with Spreadsheet::ParseExcel)
Text::CSV_XS

CAVEATS

It probably will not work work with spreadsheets that use formulas.

A line in the spreadsheet is assumed to be blank if there is nothing in the first column.

Some users have reported problems trying to convert a spreadsheet while it was opened in a different application. You should probably make sure that no other programs are working with the spreadsheet while you are converting it.

AUTHOR

Ken Prows (perl@xev.net)

COPYRIGHT

Copyright (C) 2005 Ken Prows. All rights reserved.

This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.