-
Notifications
You must be signed in to change notification settings - Fork 11
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
treat namedRegion as dims #37
Comments
well, at least for now it's possible to write a named redgion. one step at a time |
Maybe a named region can be used with empty dims and |
|
I started work on #548 I wanted to improve the ability sketched below library(openxlsx2)
# create a workbook with a named region
wb <- wb_workbook() |>
wb_add_worksheet() |>
wb_add_named_region(
name = "named_region",
dims = wb_dims(
rows = 5:7,
cols = 6:8
)
)
# get the named region
nr <- wb$get_named_regions()
nr
#> name value sheets coords id local sheet
#> 1 named_region 'Sheet 1'!$F$5:$H$7 Sheet 1 F5:H7 1 0 1
# create a matrix of 1
mat <- dims_to_dataframe(nr$coords)
mat[is.na(mat)] <- 1
# write the data on the sheet
wb$add_data(sheet = nr$sheets, dims = nr$coords, x = mat, colNames = FALSE)
# read the data from the sheet
wb_to_df(wb, sheet = nr$sheets, dims = nr$coords, colNames = FALSE)
#> F G H
#> 5 1 1 1
#> 6 1 1 1
#> 7 1 1 1 |
Should add some update named region function by name and sheet |
Maybe we can integrate this into an |
when calling
writeData()
it should be possible to easily write into a named region instead of just dimsThe text was updated successfully, but these errors were encountered: