in reply to How to read the value of a variable (read from a Excel file converted Into text file) and put then back into Excel column

Hello rockyurock

Update: After experimenting with the Spreadsheet::ParseExcel::SaveParser I noticed that it can not process xlsx file formats only xls file formats. Which in your case is not what you are looking for.

So I checked again online and I found Excel::Writer::XLSX. The problem with this module is that only produces new xlsx files it can not read and process new same file. Taken from documentation:

Excel::Writer::XLSX - Create a new file in the Excel 2007+ XLSX format +.

So I tested it with the following example code:

#!/usr/bin/perl use strict; use warnings; use Excel::Writer::XLSX; # Create a new workbook called simple.xls and add a worksheet my $workbook = Excel::Writer::XLSX->new( 'a_simple.xlsx' ); my $worksheet = $workbook->add_worksheet(); # The general syntax is write($row, $column, $token). Note that row an +d # column are zero indexed # # Write some text $worksheet->write( 0, 0, "Hi Excel!" ); # Write some numbers $worksheet->write( 2, 0, 3 ); # Writes 3 $worksheet->write( 3, 0, 3.00000 ); # Writes 3 $worksheet->write( 4, 0, 3.00001 ); # Writes 3.00001 $worksheet->write( 5, 0, 3.14159 ); # TeX revision no.? # Write some formulas $worksheet->write( 7, 0, '=A3 + A6' ); $worksheet->write( 8, 0, '=IF(A5>3,"Yes", "No")' ); # Write a hyperlink my $hyperlink_format = $workbook->add_format( color => 'blue', underline => 1, ); $worksheet->write( 10, 0, 'http://www.perl.com/', $hyperlink_format );

On my linux operating system worked perfect produced the a_simple.xlsx and openoffice was able to open the file and read it without any problems. I do not have a Windows OS to test it but by 99.9% it will work just fine.

So my proposed solution is to use your script that reads and parses your data and then create a new update xlsx sheet with the module.

End of Update

I think you are looking for this (Spreadsheet::ParseExcel::SaveParser). Taken from the documentation of the module:

Spreadsheet::ParseExcel::SaveParser - Rewrite an existing Excel file.

The module that you are using can only read the excel file. Taken from (Spreadsheet::Read):

Spreadsheet::Read - Read the data from a spreadsheet
Seeking for Perl wisdom...on the process of learning...not there...yet!
  • Comment on Re: How to read the value of a variable (read from a Excel file converted Into text file) and put then back into Excel column
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: How to read the value of a variable (read from a Excel file converted Into text file) and put then back into Excel column
by rockyurock (Acolyte) on Feb 20, 2017 at 13:30 UTC
    So which package can help me with reading and writing both ?

      Which Operating System ?. If windows then Win32::OLE perhaps

      poj
        yes. It;s Windows 7