use strict; use warnings; use Tk; use Win32::LongPath; use Spreadsheet::ParseXLSX; my $mw = Tk::MainWindow->new(); my $path; my $button = $mw->Button( -text => "Select a file", -command => \&show_file_dialog, )->pack(-side => 'left',); my $label = $mw->Label( -text => 'No file yet', )->pack(-side => 'left',); $mw->MainLoop(); sub show_file_dialog { my @ext = ( ["Excel", ['xlsx']], ["All files", ['*']], ); $path = $mw->getOpenFile( -filetypes => \@ext, ); #use shortpath my $ShortPath = shortpathL ($path); #print path read and path converted with short path inside Tk $label->configure(-text => "$path - $ShortPath"); print "try to open file with shortpathL path\n"; my $parser = Spreadsheet::ParseXLSX->new(); my $workbook = $parser->parse($ShortPath); print "try to open file with original path\n"; my $parser = Spreadsheet::ParseXLSX->new(); my $workbook = $parser->parse($path); }