Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy Row to different worksheet #56

Closed
cesugden opened this issue Jun 22, 2017 · 2 comments
Closed

Copy Row to different worksheet #56

cesugden opened this issue Jun 22, 2017 · 2 comments

Comments

@cesugden
Copy link

cesugden commented Jun 22, 2017

I'm trying to copy a row to a different worksheet. I can't find an easy way of doing it. Is what I've written here the best way?

` $row = @(Get-CellValue -worksheet $Worksheet -Coordinates "A2:J2")

$DifferentWorksheet.SetValue($lastrow,1, $row.'#')

$DifferentWorksheet.SetValue($lastrow,2, $row.Action)

$DifferentWorksheet.SetValue($lastrow,3, $row.Project)

$DifferentWorksheet.SetValue($lastrow,4, $row.Context)

$DifferentWorksheet.SetValue($lastrow,5, $row.Area)

$DifferentWorksheet.SetValue($lastrow,6, $row.Time)

$DifferentWorksheet.SetValue($lastrow,7, $row.Due)

$DifferentWorksheet.SetValue($lastrow,8, $row.NA)

$DifferentWorksheet.SetValue($lastrow,9, $row.Created)

$DifferentWorksheet.SetValue($lastrow,10, $row.Finished)

$excel.save()`

@cesugden
Copy link
Author

cesugden commented Jun 25, 2017

Figured it out. Sorry didn't realise to look at EPPlus docs

$WorkSheet.Cells["A2:J2"].Copy($DifferentWorkSheet.Cells["A2:J2"])

@RamblingCookieMonster
Copy link
Owner

Good find! Thanks for sharing! Yeah, PSExcel is somewhat limited in terms of working with existing data, the EPPlus library is always a good bet

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants