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

Duplicate Sheets within Workbook #330

Open
ywebbvar opened this issue Sep 30, 2017 · 1 comment
Open

Duplicate Sheets within Workbook #330

ywebbvar opened this issue Sep 30, 2017 · 1 comment

Comments

@ywebbvar
Copy link

Hi!

Thank you for the great R package!

Expected Behavior

I would like to be able to duplicate (or n-plicate) sheets within a workbook. Is there already a function for this?

I was expecting to do:

wb <- createWorkbook()
addWorksheet(wb, "Moving Row")
negStyle <- createStyle(fontColour = "#9C0006", bgFill = "#FFC7CE")
posStyle <- createStyle(fontColour = "#006100", bgFill = "#C6EFCE")

writeData(wb, "Moving Row", -5:5)
writeData(wb, "Moving Row", LETTERS[1:11], startCol=2)
conditionalFormatting(wb, "Moving Row", cols=1:2, rows=1:11, rule="$A1<0", style = negStyle)
conditionalFormatting(wb, "Moving Row", cols=1:2, rows=1:11, rule="$A1>0", style = posStyle)

wb[["Moving Row 2"]] <- wb[["Moving Row"]]
names(wb)

and get

[1] "Moving Row" "Moving Row 2"

Actual Behavior

The sheet is not copied:

[1] "Moving Row"

Steps to Reproduce the Problem

(please attach an example xlsx file if possible)

  1. Create a workbook with a template sheet

  2. Attempt to duplicate the template sheet with a general assignment

  • Version of openxlsx: 4.0.17
  • Version of R: 3.3.0
@kovla
Copy link

kovla commented Apr 29, 2018

XLConnect has cloneSheet() function. Might be a temporary workarnound until something similar is implemented in openxlsx.

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