How to extract data from one Excelsheet and insert into an other Excelsheet with a Perl Script
I have a question. I've got 2 different Excelsheets. From the first Excelsheet I want to extract some specific rows from specific columns into a row of an other Excelsheet. But I have problem with extracting the specific rows from the first Excelsheet with an Perl script. The function autofilter() and filter_columns() don't seem to work. This case is maybe a little complicated, but I would be vey happy if someone could help me.
<table><tbody><tr><th>Software</th><th> </th><th> </th><th>User</th><th> </th><th>Division</th></tr><tr><td>Software1</td><td> </td><td> </td><td>Pete;John</td><td> </td><td>Marketing</td></tr><tr><td>Software2</td><td> </td><td> </td><td>Jack;Pete</td><td> </td><td>Marketing</td></tr><tr><td>Software3</td><td> </td><td> </td><td>Jessica;Tina</td><td> </td><td>Sales</td></tr><tr><td>Software4</td><td> </td><td> </td><td>Timmy;Ron</td><td> </td><td>Finance</td></tr><tr><td>Software5</td><td> </td><td> </td><td>Pete;Oliver</td><td> </td><td>Marketing</td></tr></tbody></table>
This is what the Excelsheet looks like. Here for example I want to extract every software which is used by Pete and is in the Marketing division. These softwares I want to extract into another Excelsheet. But first I want to focus on the filtering of the data.
I am an absoulte beginner with programming. I could not do more than in the code below, where atleast I can extract all Software from the Excelsheet.
use strict;
use warnings;
use Spreadsheet::WriteExcel;
use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::SaveParser;
use Spreadsheet::ParseExcel::Worksheet;
use WIN32::OLE::Const 'Microsoft Excel'
use Spreadsheet::WriteExcelXML;
# Open an existing file with SaveParser
my $parser = Spreadsheet::ParseExcel->new();
my $template = $parser->Parse('Softwarelist.xls');
# Get the first worksheet of Softwarelist Workbook
my $worksheet = $template->worksheet(0);
# Filtering Software Collumn
my $SELECT_COL = 0;
my ($row_min, $row_max) = $worksheet->row_range();
for (;$row_min<$row_max; )
{
my $cell = $worksheet->get_cell($row_min, $SELECT_COL);
next unless $cell;
$cell = $cell->value();
print "$celln"
$row_min = $row_min +1;
}
excel perl
add a comment |
I have a question. I've got 2 different Excelsheets. From the first Excelsheet I want to extract some specific rows from specific columns into a row of an other Excelsheet. But I have problem with extracting the specific rows from the first Excelsheet with an Perl script. The function autofilter() and filter_columns() don't seem to work. This case is maybe a little complicated, but I would be vey happy if someone could help me.
<table><tbody><tr><th>Software</th><th> </th><th> </th><th>User</th><th> </th><th>Division</th></tr><tr><td>Software1</td><td> </td><td> </td><td>Pete;John</td><td> </td><td>Marketing</td></tr><tr><td>Software2</td><td> </td><td> </td><td>Jack;Pete</td><td> </td><td>Marketing</td></tr><tr><td>Software3</td><td> </td><td> </td><td>Jessica;Tina</td><td> </td><td>Sales</td></tr><tr><td>Software4</td><td> </td><td> </td><td>Timmy;Ron</td><td> </td><td>Finance</td></tr><tr><td>Software5</td><td> </td><td> </td><td>Pete;Oliver</td><td> </td><td>Marketing</td></tr></tbody></table>
This is what the Excelsheet looks like. Here for example I want to extract every software which is used by Pete and is in the Marketing division. These softwares I want to extract into another Excelsheet. But first I want to focus on the filtering of the data.
I am an absoulte beginner with programming. I could not do more than in the code below, where atleast I can extract all Software from the Excelsheet.
use strict;
use warnings;
use Spreadsheet::WriteExcel;
use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::SaveParser;
use Spreadsheet::ParseExcel::Worksheet;
use WIN32::OLE::Const 'Microsoft Excel'
use Spreadsheet::WriteExcelXML;
# Open an existing file with SaveParser
my $parser = Spreadsheet::ParseExcel->new();
my $template = $parser->Parse('Softwarelist.xls');
# Get the first worksheet of Softwarelist Workbook
my $worksheet = $template->worksheet(0);
# Filtering Software Collumn
my $SELECT_COL = 0;
my ($row_min, $row_max) = $worksheet->row_range();
for (;$row_min<$row_max; )
{
my $cell = $worksheet->get_cell($row_min, $SELECT_COL);
next unless $cell;
$cell = $cell->value();
print "$celln"
$row_min = $row_min +1;
}
excel perl
Thatfor
loop looks odd. Conventionally, you'd use awhile
loop in Perl there:while ($row_min<$row_max)
– toolic
Nov 13 '18 at 21:22
That doesn't look like a spreadsheet, it looks like an HTML table.
– Dave Cross
Nov 14 '18 at 9:23
add a comment |
I have a question. I've got 2 different Excelsheets. From the first Excelsheet I want to extract some specific rows from specific columns into a row of an other Excelsheet. But I have problem with extracting the specific rows from the first Excelsheet with an Perl script. The function autofilter() and filter_columns() don't seem to work. This case is maybe a little complicated, but I would be vey happy if someone could help me.
<table><tbody><tr><th>Software</th><th> </th><th> </th><th>User</th><th> </th><th>Division</th></tr><tr><td>Software1</td><td> </td><td> </td><td>Pete;John</td><td> </td><td>Marketing</td></tr><tr><td>Software2</td><td> </td><td> </td><td>Jack;Pete</td><td> </td><td>Marketing</td></tr><tr><td>Software3</td><td> </td><td> </td><td>Jessica;Tina</td><td> </td><td>Sales</td></tr><tr><td>Software4</td><td> </td><td> </td><td>Timmy;Ron</td><td> </td><td>Finance</td></tr><tr><td>Software5</td><td> </td><td> </td><td>Pete;Oliver</td><td> </td><td>Marketing</td></tr></tbody></table>
This is what the Excelsheet looks like. Here for example I want to extract every software which is used by Pete and is in the Marketing division. These softwares I want to extract into another Excelsheet. But first I want to focus on the filtering of the data.
I am an absoulte beginner with programming. I could not do more than in the code below, where atleast I can extract all Software from the Excelsheet.
use strict;
use warnings;
use Spreadsheet::WriteExcel;
use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::SaveParser;
use Spreadsheet::ParseExcel::Worksheet;
use WIN32::OLE::Const 'Microsoft Excel'
use Spreadsheet::WriteExcelXML;
# Open an existing file with SaveParser
my $parser = Spreadsheet::ParseExcel->new();
my $template = $parser->Parse('Softwarelist.xls');
# Get the first worksheet of Softwarelist Workbook
my $worksheet = $template->worksheet(0);
# Filtering Software Collumn
my $SELECT_COL = 0;
my ($row_min, $row_max) = $worksheet->row_range();
for (;$row_min<$row_max; )
{
my $cell = $worksheet->get_cell($row_min, $SELECT_COL);
next unless $cell;
$cell = $cell->value();
print "$celln"
$row_min = $row_min +1;
}
excel perl
I have a question. I've got 2 different Excelsheets. From the first Excelsheet I want to extract some specific rows from specific columns into a row of an other Excelsheet. But I have problem with extracting the specific rows from the first Excelsheet with an Perl script. The function autofilter() and filter_columns() don't seem to work. This case is maybe a little complicated, but I would be vey happy if someone could help me.
<table><tbody><tr><th>Software</th><th> </th><th> </th><th>User</th><th> </th><th>Division</th></tr><tr><td>Software1</td><td> </td><td> </td><td>Pete;John</td><td> </td><td>Marketing</td></tr><tr><td>Software2</td><td> </td><td> </td><td>Jack;Pete</td><td> </td><td>Marketing</td></tr><tr><td>Software3</td><td> </td><td> </td><td>Jessica;Tina</td><td> </td><td>Sales</td></tr><tr><td>Software4</td><td> </td><td> </td><td>Timmy;Ron</td><td> </td><td>Finance</td></tr><tr><td>Software5</td><td> </td><td> </td><td>Pete;Oliver</td><td> </td><td>Marketing</td></tr></tbody></table>
This is what the Excelsheet looks like. Here for example I want to extract every software which is used by Pete and is in the Marketing division. These softwares I want to extract into another Excelsheet. But first I want to focus on the filtering of the data.
I am an absoulte beginner with programming. I could not do more than in the code below, where atleast I can extract all Software from the Excelsheet.
use strict;
use warnings;
use Spreadsheet::WriteExcel;
use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::SaveParser;
use Spreadsheet::ParseExcel::Worksheet;
use WIN32::OLE::Const 'Microsoft Excel'
use Spreadsheet::WriteExcelXML;
# Open an existing file with SaveParser
my $parser = Spreadsheet::ParseExcel->new();
my $template = $parser->Parse('Softwarelist.xls');
# Get the first worksheet of Softwarelist Workbook
my $worksheet = $template->worksheet(0);
# Filtering Software Collumn
my $SELECT_COL = 0;
my ($row_min, $row_max) = $worksheet->row_range();
for (;$row_min<$row_max; )
{
my $cell = $worksheet->get_cell($row_min, $SELECT_COL);
next unless $cell;
$cell = $cell->value();
print "$celln"
$row_min = $row_min +1;
}
<table><tbody><tr><th>Software</th><th> </th><th> </th><th>User</th><th> </th><th>Division</th></tr><tr><td>Software1</td><td> </td><td> </td><td>Pete;John</td><td> </td><td>Marketing</td></tr><tr><td>Software2</td><td> </td><td> </td><td>Jack;Pete</td><td> </td><td>Marketing</td></tr><tr><td>Software3</td><td> </td><td> </td><td>Jessica;Tina</td><td> </td><td>Sales</td></tr><tr><td>Software4</td><td> </td><td> </td><td>Timmy;Ron</td><td> </td><td>Finance</td></tr><tr><td>Software5</td><td> </td><td> </td><td>Pete;Oliver</td><td> </td><td>Marketing</td></tr></tbody></table>
<table><tbody><tr><th>Software</th><th> </th><th> </th><th>User</th><th> </th><th>Division</th></tr><tr><td>Software1</td><td> </td><td> </td><td>Pete;John</td><td> </td><td>Marketing</td></tr><tr><td>Software2</td><td> </td><td> </td><td>Jack;Pete</td><td> </td><td>Marketing</td></tr><tr><td>Software3</td><td> </td><td> </td><td>Jessica;Tina</td><td> </td><td>Sales</td></tr><tr><td>Software4</td><td> </td><td> </td><td>Timmy;Ron</td><td> </td><td>Finance</td></tr><tr><td>Software5</td><td> </td><td> </td><td>Pete;Oliver</td><td> </td><td>Marketing</td></tr></tbody></table>
excel perl
excel perl
asked Nov 13 '18 at 21:09
Jackson5Jackson5
1
1
Thatfor
loop looks odd. Conventionally, you'd use awhile
loop in Perl there:while ($row_min<$row_max)
– toolic
Nov 13 '18 at 21:22
That doesn't look like a spreadsheet, it looks like an HTML table.
– Dave Cross
Nov 14 '18 at 9:23
add a comment |
Thatfor
loop looks odd. Conventionally, you'd use awhile
loop in Perl there:while ($row_min<$row_max)
– toolic
Nov 13 '18 at 21:22
That doesn't look like a spreadsheet, it looks like an HTML table.
– Dave Cross
Nov 14 '18 at 9:23
That
for
loop looks odd. Conventionally, you'd use a while
loop in Perl there: while ($row_min<$row_max)
– toolic
Nov 13 '18 at 21:22
That
for
loop looks odd. Conventionally, you'd use a while
loop in Perl there: while ($row_min<$row_max)
– toolic
Nov 13 '18 at 21:22
That doesn't look like a spreadsheet, it looks like an HTML table.
– Dave Cross
Nov 14 '18 at 9:23
That doesn't look like a spreadsheet, it looks like an HTML table.
– Dave Cross
Nov 14 '18 at 9:23
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289523%2fhow-to-extract-data-from-one-excelsheet-and-insert-into-an-other-excelsheet-with%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289523%2fhow-to-extract-data-from-one-excelsheet-and-insert-into-an-other-excelsheet-with%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
That
for
loop looks odd. Conventionally, you'd use awhile
loop in Perl there:while ($row_min<$row_max)
– toolic
Nov 13 '18 at 21:22
That doesn't look like a spreadsheet, it looks like an HTML table.
– Dave Cross
Nov 14 '18 at 9:23