On Jun 6, 2012, at 1:20 PM, Ken Furff wrote:

> ok so I figured out that Spreadsheet::writeExcel only writes new spreadsheets 
> and that its difficult to overwrite cells or append them in an existing 
> spreadsheet. 
> 
> Is there a module out there that I can use to do what I'm trying to do?

You can look at Spreadsheet::ParseExcel::SaveParser:

<http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.59/lib/Spreadsheet/ParseExcel/SaveParser.pm>

The author of Spreadsheet::ParseExcel and Spreadsheet::WriteExcel has combined 
them into a module that allows you to modify an existing spreadsheet. I haven't 
used it.


> I have written a script which uses Spreadsheet::xlsx to pull data from two 
> columns  
> and compare the product id codes in the cells. If the product ID from Column 
> A exists anywhere in Column D that means there is a price change. The new 
> price is in column B. I need to copy the price to Column R. 
> 
> if the product ID from A doesnt exist in D, it means its a new product and it 
> is copied to a spreadsheet that I make with WriteExcel. That works perfectly. 

What about the case where a product exists but does not have a price change?

> 
> heres my code:
> 
> 
> 
> I don't care how this is accomplished. There are 24 columns of information 
> that need to stay intact in the spreadsheet. I just need to rewrite column R 
> with the new prices. someone please point me to a way to do this. 

Using the Spreadsheet or Excel modules, you have to create a new, empty 
spreadsheet and copy cell data from the existing spreadsheet to the new 
spreadsheet and then add or overwrite cells as needed. That is what (I think) 
the Spreadsheet::ParseExcel::SaveParser module does, or you can do it yourself.

You might want to stick to one spreadsheet format: xls or xlsx.

If you want to write an xlsx spreadsheet, use the Excel::Writer::XLSX module.
 


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to