I was having some issue dealing with arrays and going back and forth between Excel and Python, usually regarding the orientation of the array range I've selected in Excel.
One such issue I was having was with the following code:
contracts = xl.Sheets(pSheetName).Range("V3:AC3").Value
xl.Sheets(ccSheetName).Range("K8:R8").Value = contracts
xl.Sheets(ccSheetName).Range("K10").Value = len(contracts)
I have list of 8 contract names arranged horizontally, and store them in an array called "contracts." When I set a range of 8 cells between 'K8' and 'R8', it pastes the 8 contracts perfectly. However, cell 'K10' displays a value of 1, even though contracts has 8 items in it. Is there a reason for this behavior that I'm not aware of, or a way to work around it?
And as a follow up question, if instead of pasting the contents of the array "contracts" in cells "K8:R8," I attempted to paste them in vertical fashion through cells "K8:K15," I end up getting 8 cells all filled with only the element in contents. Is there a way to easily be able to pass arrays between python and excel so they aren't adversely affected by orientation?
Thanks and I would appreciate any help!