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

[R/write] update cell dups #249

Merged
merged 11 commits into from
Jun 27, 2022
Merged

[R/write] update cell dups #249

merged 11 commits into from
Jun 27, 2022

Conversation

JanMarvin
Copy link
Owner

why

This addresses an issue I observed when writing a file at work (unfortunately I could not yet trigger it at home. I've inserted a !duplicated() anyways). What I wanted to do is the following:

# load a file like this
wb <- wb_load("inst/extdata/oxlsx2_sheet.xlsx")

# modify some data
z <- wb_to_df(wb, 1, dims = "B5:I20", na.strings = "N/A", skipEmptyRows = TRUE)
sel <- c("V1_abs", "V2_abs", "V3_abs")
z[sel] <- z[sel] / 10

# clone the original sheet
wb$clone_worksheet(1, "clone")

# add the data back to the cloned sheet
wb$add_data(2, z, startCol = 2, startRow = 5)

# open the file again
wb$open()

notable changes

Previously we:

  • wrote <v>NA</v> when writing to a sheet. This is not allowed unless we write to a cell that expects some formula evaluation text output (t=str) or to a inline character. This is now fixed
  • used replaceCellStyle = TRUE this is now changed. I want this feature, therefore it is not negotiable. Nah, not really, but any objections?

ideally

We would replace the slow loop here and use something to create two cc and row_attr objects and merge them and only update what is needed from the merge. This would speed things up a lot. Unfortunately I'm to lazy right now to implement this.

@JanMarvin JanMarvin linked an issue Jun 26, 2022 that may be closed by this pull request
@JanMarvin JanMarvin added this to the v0.3.0 rc2 milestone Jun 26, 2022
@JanMarvin JanMarvin merged commit d03fb54 into main Jun 27, 2022
@JanMarvin JanMarvin deleted the update_cell_dups branch June 27, 2022 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update_cell() creates duplicates
1 participant