-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support writing formulas #5
Comments
I need often a very specific type of formula, namely a hyperlink. |
How would you expect to use this? I suppose you don't want to write an entire column of formulas? |
My use case is to have a full column only containing formulas, in this case the formula "HYPERLINK". So I could expect to use this like this: Then we could add a parameter to the "write_xlsx" function, which allows to specify that certain columns are formula, so
Not sure, how this can be fitted with the original request, to specify individual cells as formula. My proposal might be the most general (and rather easy to implement, case). What the upper code would not allow is to have "formula" and "non formula" in the same column. To implement the very general case, which would allows to specify Excel columns having To have this, we need a function which can specify the data to write as a list of lists. |
Yes, for whole columns. (I will use it to generate sheets used for correction exams, and there will be a Total column with the total number of points.) Maybe this can be solved with |
Can you provide an example xlsx with what you want, then I can see what it looks like and try to regenerate such a file with writexl. |
I have added some experimental support for an devtools::install_github("ropensci/writexl") See example here. Can you test if this works for you? |
Thanks! In LibreOffice Calc, the If I do a simple calculation formula like
Then when opening in LibreOffice Calc, the cell contents of This may be a LibreOffice Calc problem. |
I have not tried yet with MS Excel.
But for my use case, ("hyperlinks in columns", I noticed that it works for
Libre Office by just writing a "csv" file
and having character cell content such as "=HYPERLINK('http://google.com')".
This does not produced a "visible" link in LibreOffice (not "blue" or
something") but a tooltip and I can "ctrl-click" on it to open in browser.
I will trie your example with Excel.
…On Wed, Sep 20, 2017 at 8:38 AM, Mikkel Meyer Andersen < ***@***.***> wrote:
Thanks!
In LibreOffice Calc, the age column is fine, but the website column is
just 0, but with the correct formula.
If I do a simple calculation formula like
library(writexl)
library(tidyverse)
df <- data.frame(
name = c("UCLA", "Berkeley"),
founded = c(1919, 1868)
) %>%
mutate(founded_formula = xl_formula(paste0('=B', row_number()+1, '+1000')))
write_xlsx(df, path = 'test.xlsx')
Then when opening in LibreOffice Calc, the cell contents of
founded_formula is also just 0, but the formula is correct. If I copy the
formula to a new cell, the correct numbers appear. It does not help to
Recalculate (F9).
This may be a LibreOffice Calc problem.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAHxgRCkrJLj6fc7tYKraAwqGS0EmaXAks5skLLUgaJpZM4PQui7>
.
|
The hyperlink do work, so I can click them. |
@mikldk That seems to be a LibreOffice Calc problem. I tested with Excel, which recalculates the spreadsheet when it loads. |
I have just added a special |
@jmcnamara is there something like |
For me the hyperlinks work, thanks for implementing |
Just getting to this now.
I could add a However, using a |
@jeroen Can I make the suggestion once more that hyperlinks should be converted using the There are a few benefits to this:
|
I landed in this FR while looking for some functionality that allowed me to write a formula to a cell in a similar way to the python package XlsxWriter. My use-case:
In the mentioned python package the method would be |
@PavoDive You can already do this with library(tidyverse)
library(writexl)
tibble(unit = 1, price = 2, value = xl_formula("=A2 * B2")) %>%
write_xlsx("test.xlsx") Created on 2023-12-07 with reprex v2.0.2 |
Would it be possible to support writing formulas, too? Maybe for R's formula type.
The text was updated successfully, but these errors were encountered: