Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advice using Spreadsheet:: modules .....? 1

Status
Not open for further replies.

rabinski

Programmer
May 13, 2005
21
GB
Hi again gurus -

A more general question this time -

Is it feasible to read in 2 spreadsheets (with say Spreadsheet::parseExcel) and combine the two into one ...

Each of the input spreadsheets will only have one worksheet ... I just need to put them both into one ...

Any pointers would be great !

cheers

Rab

 
There's no trivial way. The WriteExcel stuff doesn't read the output from the parsing modules so you can't just clone an object.

It's feasible and not too hard to copy cell by cell. It rapidly gets painful if you need to consider formats or worse.

To just copy values, open the destination object and add a sheet. Open the first source book, take the first sheet, get the maximum row and column indicies and then loop through every cell in the range, reading it's value and setting the same value in the destination sheet.

Close the destination sheet and repeat, adding a second sheet for the second source book.

Close the destination sheet and book and you're done.

There's nothing particularly complicated in this and the manual pages are well-written and include examples, so you should have little trouble getting it to work.

See how far you get and come back if you get stuck.

Yours,

f

"As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilkes
 
cheers fishi

Wil let you know next week ....

Rab
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top