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

Copying a worksheet to a new workbook does not copy relevant global names #345

Open
craigbrown opened this issue Mar 29, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@craigbrown
Copy link

Hi, I think I've found another bug with copying worksheets (sorry).

If I copy a worksheet to a new workbook, and that worksheet contains cells that are 'global' names (i.e. names defined at the workbook level), EPPlus doesn't copy those names. This means that any formula on the worksheet that references that name will be broken on the copied sheet.

If I try the same thing in Excel, the global names on the sheet do get copied.

@JanKallman
Copy link
Contributor

EPPlus don't copy workbook defined names when using a worksheet as template today. For now you will have to copy any defined name on the worksheet level yourself.
To add this functionality we will have to check all formulas for references to defined names on this level.
I'll add this as an enhancement for a future version.

@craigbrown
Copy link
Author

Great, thanks.

Just to clarify, as I think there's two possible things here:

  1. Global Names which reference a range on the sheet being copied (e.g. if I name Sheet1!A1 as MyRange, should MyRange be copied when I copy Sheet1?)
  2. Formulas on the sheet which use a Global Name, where that name might be on a different sheet (e.g. if Sheet2 uses MyRange in a formula, should MyRange be copied when I copy Sheet2?)

In this issue I'm just talking about number 1 (which I think should just mean checking all the workbook's defined names?). I think number 2 could be quite slow and wouldn't be in line with what Excel does anyway.

@JanKallman
Copy link
Contributor

Yes, I see your point. I'll have a look at it for a future version.

@JanKallman JanKallman added the enhancement New feature or request label Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants