use strict; use warnings; use autodie; use Spreadsheet::Read qw/ ReadData rows /; use Text::CSV; my $outputFile = '1198074.csv'; my $inputFile = '1198074.xlsx'; my $book = ReadData( $inputFile ); my @writeRows; for my $row ( rows( $book->[1] ) ) { my ( $id, $last, $first, $pref ) = @{ $row }; push @writeRows, [ $pref || $first, $last, 'Static', 'Text' ]; } open my $fh, '>:encoding(UTF-16LE)', $outputFile; my $csv = Text::CSV->new( { binary => 1, eol => "\n", auto_diag => 1 } ); $csv->print( $fh, $_ ) for @writeRows; close $fh; __END__