Hi Monks, Is it possible via 'perl' to disable users from cut, copy & pasting data. I have created a xlsx worksheet with the use of the Excel::Writer::XLSX; module, but even though numerous columns have format vailadations set, it is still possible to copy data into those cells. this is just a short sample of my script below.

#!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; use Excel::Writer::XLSX; my $workbook = Excel::Writer::XLSX->new("C:\\Temp\\test.xlsx"); my $worksheet1 = $workbook->add_worksheet(); $worksheet1->freeze_panes( 1, 0 ); my $unlocked = $workbook->add_format( locked => 0 ); my $header = $workbook->add_format( locked => 1 ); my $header2 = $workbook->add_format( locked => 1 ); $header->set_color('white'); $header->set_align('left'); $header->set_pattern(); $header->set_bg_color('orange'); $worksheet1->protect(); for my $i ( 0 .. 60 ) { $worksheet1->write( 0, $i, 'header', $header, ); } my @score_attain = ( 'P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8', '1W', '1W+', '1B', '1B+', '1S', '1S+', '2W', '2W+', '2B', '2B+', '2S', '2S+', '3W', '3W+', '3B', '3B+', '3S', '3S+', '4W', '4W+', '4B', '4B+', '4S', '4S+', '5W', '5W+', '5B', '5B+', '5S', '5S+', ); for my $i ( 1 .. 1000 ) { $worksheet1->data_validation( $i, 6, { validate => 'list', source => [@score_attain], input_title => 'Select an option', input_message => 'Select a value from the drop down list', error_title => 'Input value is not valid!', error_message => 'Select a value from the drop down list', } ); } for my $i ( 1 .. 100 ) { for my $j ( 0 .. 60 ) { $worksheet1->set_row( $i, undef, $unlocked ); $worksheet1->{CutCopyMode} = 0; } }

In reply to Perl script to disable cut copy % paste in an xlsx worksheet by john.tm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.