Rahul Gupta has asked for the wisdom of the Perl Monks concerning the following question:
I have some data in text file as given below
file contains same data 5 times. now, i need to parse the same thing in xlsx file. in following format------|----------|--------|-------------------------|--------| S.No | TimeStamp| UE-Name| Test-Config | UL/DL | ------|----------|--------|-------------------------|--------| 1 | 17:20:59 | ueh1 | Sanity_004_0004_24_00 | DL | ------|----------|--------|-------------------------|--------| 2 | 17:20:59 | ueh2 | Sanity_004_0004_24_00 | DL | ------|----------|--------|-------------------------|--------|
S.No TimeStamp UE-Name Test-Config UL/D +L 1 17:20:59 ueh1 Sanity_004_0004_24_00 DL + 2 17:20:59 ueh2 Sanity_004_0004_24_00 DL
can u please help me out to resolve this problem.
thanks in advance
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Parsing Data in xlsx file
by moritz (Cardinal) on Aug 01, 2012 at 18:05 UTC | |
Perlmonks is not a code writing service. We can help you solve your problem, but we won't solve it for you. Which part are you having trouble with? What code have you written so far? Excel::Writer::XLSX can write XLSX files for you, which is the hardest part of the task. | [reply] |
by Rahul Gupta (Sexton) on Aug 02, 2012 at 08:16 UTC | |
i have tried this thing all text file data is in @executioncontents array
It parse the data in xlsx file in differnt manner from the way it is in acutal file
Please anyone can help me to parse the data in xlsx file the way it is in actal file. Thanks in advance | [reply] [d/l] [select] |
by moritz (Cardinal) on Aug 02, 2012 at 08:37 UTC | |
Somehow your parsing code and your data don't seem to be related at all. For example your code checks if the data has 11 columns, but your data only has 5 columns. So no wonder it doesn't work. (Your data sample has 11 interesting rows, but I guess that's more of a coincidence. I'd approach the problem like this:
| [reply] [d/l] |
by Rahul Gupta (Sexton) on Aug 02, 2012 at 10:29 UTC | |
by Rahul Gupta (Sexton) on Aug 02, 2012 at 10:33 UTC | |
by Rahul Gupta (Sexton) on Aug 02, 2012 at 11:09 UTC | |
by roboticus (Chancellor) on Aug 02, 2012 at 11:22 UTC | |
After glancing at your code, I'd suggest you sanitize it a bit. By sanitize, I don't mean "clean up"--I mean "make less insane". If you name a function readhash I would expect that it would do something like, say, reading a hash from some source. I certainly wouldn't expect it to write a spreadsheet. Perhaps naming it something like "write_spreadsheet" would be less confusing? ...roboticus When your only tool is a hammer, all problems look like your thumb. | [reply] [d/l] |
Re: Parsing Data in xlsx file
by suaveant (Parson) on Aug 01, 2012 at 18:06 UTC | |
| [reply] |
Re: Parsing Data in xlsx file
by Kenosis (Priest) on Aug 02, 2012 at 16:34 UTC | |
Perhaps the following will work for you:
Output (copied from generated data.xlsx spreadsheet):
Hope this helps! | [reply] [d/l] [select] |