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

[fml] create shared formulas #1074

Merged
merged 6 commits into from
Jul 9, 2024
Merged

[fml] create shared formulas #1074

merged 6 commits into from
Jul 9, 2024

Conversation

JanMarvin
Copy link
Owner

library(openxlsx2)

df <- data.frame(
  x = 1:5,
  y = 1:5 * 2
)

wb <-  wb_workbook()$add_worksheet()$add_data(x = df)

wb$add_formula(
  x      = "=A2/B2",
  dims   = "C2:C6",
  shared = TRUE
)

wb$add_formula(
  x      = "=A$2/B$2",
  dims   = "D2:D6",
  shared = TRUE
)

if (interactive()) wb$open()

@JanMarvin
Copy link
Owner Author

My inspiration was this SO. Maybe you can double check @olivroy ? Just to make sure that nothing unintended happens.

This is somewhat related to #1072

@olivroy
Copy link
Collaborator

olivroy commented Jul 8, 2024

This looks good! I can check more thoroughly, but may be worth adding an example of this somewhere?

R/write.R Outdated Show resolved Hide resolved
@JanMarvin
Copy link
Owner Author

You always think in the bigger picture 👍

😄 My line of thought was something like this

  • hm this SO does not work
  • hm I can make this work
  • hm maybe this can be solved with shared strings
  • oh my tiny PR looks like it's working
  • darn, does not work
  • why doesn't it work!
  • ah, if I exclude this, it might work
  • what is this enforce argument and why isn't it documented?
  • gnar I have to fix this
  • oh it works!
  • Lets push to github, maybe Oliver knows what kind of checks are still missing

@olivroy
Copy link
Collaborator

olivroy commented Jul 8, 2024

Don't forget to increment version number too!

@JanMarvin JanMarvin merged commit a3c2f1d into main Jul 9, 2024
9 checks passed
@JanMarvin JanMarvin deleted the shared_fmls branch July 9, 2024 07:51
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

Successfully merging this pull request may close these issues.

2 participants