I'm new to perl but not to programming in general.
I hav been trying to put some data into an excel
sheet. And it works fine.... if I hardcode the data.
And I of cource I dont want to do that.
This code works:
my $table = [["040101",11,12,13,14,15],
["040102",21,22,23,24,25],
["040103",31,32,33,34,35],
["040104",41,42,43,44,45],
["040105",51,52,53,54,55]];
$Sheet->Range("A3:E7")->{Value} = $table;
So my (probably stupid) question is:
How do I create the $table array dynamicly?
foreach (sort (keys %My_hash)) {
my $A = $My_hash{$_} { data_a };
my $B = $My_hash{$_} { data_b };
my $C = $My_hash{$_} { data_c };
my $D = $My_hash{$_} { data_d };
my $E = $My_hash{$_} { data_e };
And here I would like to create each "row" in the array
}
I have tried using an normal array like this but this goes wrong.
I get nonsens data in my excel file.
my @arr;
foreach (sort (keys %My_hash)) {
my $A = $My_hash{$_} { data_a };
my $B = $My_hash{$_} { data_b };
my $C = $My_hash{$_} { data_c };
my $D = $My_hash{$_} { data_d };
my $E = $My_hash{$_} { data_e };
push @arr, [$_, $A, $B, $C, $D, $D];
}
$Sheet->Range("A3:E7")->{Value} = @arr;
I'm quite sure ther is somthing basic I'm missing.
Any suggestions apreciated. 1 4145 mo****@notvalid.se writes:
Ignore this post. After reading som posts here I
have reposted my question in comp.lang.perl.misc I'm new to perl but not to programming in general.
I hav been trying to put some data into an excel sheet. And it works fine.... if I hardcode the data.
And I of cource I dont want to do that.
This code works:
my $table = [["040101",11,12,13,14,15], ["040102",21,22,23,24,25], ["040103",31,32,33,34,35], ["040104",41,42,43,44,45], ["040105",51,52,53,54,55]];
$Sheet->Range("A3:E7")->{Value} = $table; So my (probably stupid) question is: How do I create the $table array dynamicly?
foreach (sort (keys %My_hash)) { my $A = $My_hash{$_} { data_a }; my $B = $My_hash{$_} { data_b }; my $C = $My_hash{$_} { data_c }; my $D = $My_hash{$_} { data_d }; my $E = $My_hash{$_} { data_e };
And here I would like to create each "row" in the array }
I have tried using an normal array like this but this goes wrong. I get nonsens data in my excel file.
my @arr;
foreach (sort (keys %My_hash)) { my $A = $My_hash{$_} { data_a }; my $B = $My_hash{$_} { data_b }; my $C = $My_hash{$_} { data_c }; my $D = $My_hash{$_} { data_d }; my $E = $My_hash{$_} { data_e };
push @arr, [$_, $A, $B, $C, $D, $D]; }
$Sheet->Range("A3:E7")->{Value} = @arr;
I'm quite sure ther is somthing basic I'm missing.
Any suggestions apreciated. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Scott Beavers |
last post by:
I'm trying to create a form in Excel to sort from the form and take the data
to another worksheet.
I am very new to this and any help would be appreciated.
I have a value in a cell that will...
|
by: moller |
last post by:
I'm reposting this under a more appropriate subject
since excel really has nothing to do with my problem.
I'm new to perl but not to programming in general.
I have been trying to put some...
|
by: August1 |
last post by:
A handful of articles have been posted requesting information on how
to use these functions in addition to the time() function as the seed
to generate unique groups (sets) of numbers - each group...
|
by: zxo102 |
last post by:
Hi there,
I need your help for python <--> excel. I want to paste selected
cells (range) to different location on the same sheet in Excel through
python. I have tried it for a while but could not...
|
by: Mansi |
last post by:
I'm trying to automate excel from c#. One of the things I need to do is to
copy/paste/insert rows in excel via c# code.
I tried to do the following:
1) Select a row in excel (a12 to k12)
2)...
|
by: pmud |
last post by:
Hi,
I need to use an Excel Sheet in ASP.NET application so that the users can
enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever
the USER ENETRS needs to go to the...
|
by: George |
last post by:
Is there a fast way to transfer an Excel range to an array?
Example:
Excel range is E2:E300
Dim person() as string
Thanks,
George
|
by: Nicholas Dreyer |
last post by:
Operating System: Microsoft Windows Version 5.1 (Build
2600.xpsp_sp2_gdr.050301-1519 : Service Pack 2)
Visual Basic: MIcrosoft Visual Basic 6.3 Version 9972 VBA: Retail
6.4.9972 Forms3:...
|
by: shantanu |
last post by:
I am trying to convert a macro code to c# that will copy the values of
a column and paste to anather through paste special. Everything is
working fine but the transpose meathod to paste the column...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |