ycphs / openxlsx

openxlsx - a fast way to read and write complex xslx files
https://ycphs.github.io/openxlsx/
Other
220 stars 74 forks source link

tableName does not work #414

Closed tdlan80 closed 5 months ago

tdlan80 commented 1 year ago

I am using openxlsx library to create a workbook

wb = openxlsx::buildWorkbook(x= df, asTable = T, sheetName = "siteChar", startCol = "A", startRow = 2, colNames = T, borders = "all", tableName = "tabName",)

followed by saving the above workbook:

openxlsx::saveWorkbook(wb = wb, file = "wb.xlsx", overwrite = T)

These commands work fine, except that when i opened by wb.xlsx file manually, I do not see the tableName I assigned although I see the dataframe I created.

I also tried writeDataTable function to include a different dataframe and to assign it a tableName

openxlsx::writeDataTable(wb = wb, sheet = 1, x = df2, startCol = 5, startRow = 2, tableName = "tabName2")

followed by saveWorkbook()

I can add a new dataframe as I wanted, but i do not see the tableNameI assigned when I manually open the excel workbook.

can you help me on how to add a tableNameto each dataframe I in my excel workbook?

sessionInfo()

R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C LC_TIME=English_United States.utf8

attached base packages: [1] tcltk stats graphics grDevices utils datasets methods base

other attached packages: [1] openxlsx2_0.5.1 openxlsx_4.2.5.2 WriteXLS_6.4.0 ggpie_0.2.5 scales_1.2.1 ggprism_1.0.4
[7] gridExtra_2.3 indicspecies_1.7.12 ggrepel_0.9.3 MASS_7.3-58.2 BiodiversityR_2.15-1 vegan_2.6-4
[13] lattice_0.20-45 permute_0.9-7 writexl_1.4.2 fs_1.6.1 magick_2.7.3 tiler_0.2.5
[19] RsimMosaic_1.0.3 statsExpressions_1.5.0 ggstatsplot_0.11.0 jmuOutlier_2.2 emmeans_1.8.4-1 rcompanion_2.4.21
[25] XNomial_1.0.4 coin_1.4-2 survival_3.5-3 hablar_0.3.1 magrittr_2.0.3 janitor_2.2.0
[31] lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0 dplyr_1.1.0 purrr_1.0.1 readr_2.1.4
[37] tidyr_1.3.0 tibble_3.1.8 ggplot2_3.4.1 tidyverse_2.0.0 readxl_1.4.2 xlsx_0.6.5

loaded via a namespace (and not attached): [1] backports_1.4.1 Hmisc_4.8-0 plyr_1.8.8 splines_4.2.2 TH.data_1.1-1 digest_0.6.31 htmltools_0.5.4
[8] fansi_1.0.4 relimp_1.0-5 checkmate_2.1.0 paletteer_1.5.0 cluster_2.1.4 tzdb_0.3.0 tcltk2_1.2-11
[15] matrixStats_0.63.0 sandwich_3.0-2 timechange_0.2.0 jpeg_0.1-10 colorspace_2.1-0 mitools_2.4 haven_2.5.2
[22] xfun_0.37 libcoin_1.0-9 lme4_1.1-31 Exact_3.2 zeallot_0.1.0 zoo_1.8-11 glue_1.6.2
[29] gtable_0.3.1 car_3.1-1 abind_1.4-5 mvtnorm_1.1-3 DBI_1.1.3 rstatix_0.7.2 Rcpp_1.0.10
[36] xtable_1.8-4 performance_0.10.2 htmlTable_2.4.1 foreign_0.8-84 proxy_0.4-27 Formula_1.2-5 survey_4.1-1
[43] stats4_4.2.2 htmlwidgets_1.6.1 datawizard_0.6.5 httr_1.4.5 RColorBrewer_1.1-3 modeltools_0.2-23 ellipsis_0.3.2
[50] pkgconfig_2.0.3 rJava_1.0-6 nnet_7.3-18 multcompView_0.1-8 deldir_1.0-6 utf8_1.2.3 tidyselect_1.2.0
[57] rlang_1.0.6 munsell_0.5.0 cellranger_1.1.0 tools_4.2.2 cli_3.6.0 generics_0.1.3 broom_1.0.3
[64] fastmap_1.1.1 rematch2_2.1.2 knitr_1.42 zip_2.2.2 rootSolve_1.8.2.3 nlme_3.1-162 correlation_0.8.3
[71] compiler_4.2.2 rstudioapi_0.14 png_0.1-8 e1071_1.7-13 ggsignif_0.6.4 DescTools_0.99.48 stringi_1.7.12
[78] parameters_0.20.2 Matrix_1.5-3 nloptr_2.0.3 effects_4.2-2 vctrs_0.5.2 RcmdrMisc_2.7-2 pillar_1.8.1
[85] lifecycle_1.0.3 lmtest_0.9-40 estimability_1.4.1 data.table_1.14.8 insight_0.19.0 lmom_2.9 patchwork_1.1.2
[92] R6_2.5.1 latticeExtra_0.6-30 gld_2.6.6 codetools_0.2-19 boot_1.3-28.1 xlsxjars_0.6.1 withr_2.5.0
[99] nortest_1.0-4 Rcmdr_2.8-0 multcomp_1.4-22 mgcv_1.8-41 bayestestR_0.13.0 expm_0.999-7 parallel_4.2.2
[106] hms_1.1.2 grid_4.2.2 rpart_4.1.19 minqa_1.2.5 coda_0.19-4 class_7.3-21 snakecase_0.11.0
[113] carData_3.0-5 ggnewscale_0.4.8 ggpubr_0.6.0 base64enc_0.1-3 interp_1.1-3

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 5 months ago

This issue was closed because it has been stalled for 7 days with no activity.