我正在尝试编写一个perl脚本,它使用perl将第一个工作表中的单元格值链接到第二个工作表中的值。 我尝试使用perl中提供的以下模块: -
答案 0 :(得分:4)
使用Excel :: Writer :: XLSX,您将使用write_url后跟write_formula方法。这是一个例子:
#!/usr/bin/perl
use strict;
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new( 'test.xlsx' );
my $worksheet1 = $workbook->add_worksheet('Worksheet1');
my $worksheet2 = $workbook->add_worksheet('Worksheet2');
$worksheet2->write_string(0,0, 'Rules');
$worksheet2->write_string(1,0, 'R1');
$worksheet2->write_string(2,0, 'R2');
$worksheet2->write_string(3,0, 'R3');
my $format = $workbook->add_format( color => 'blue', underline => 1 );
$worksheet1->write_url( 1,1, 'internal:Worksheet2!A2', $format);
$worksheet1->write_formula( 1, 1, '=Worksheet2!A2' );