Skip to content

Cryptic message when overwriting docx file #2017

@raffaem

Description

@raffaem

Description

gt cannot overwrite a .docx file saved in a shared Dropbox folder, and returns a cryptic error message if the file already exist.

There are no problems overwriting .docx files saved in local folders.

Related: #1726

Reproducible example

# DropBox shared folder
infp <- file.path(paperdir, "test.docx")
mtcars %>% tibble::as_tibble() %>% gt::gt() %>% gt::gtsave(infp)
mtcars %>% tibble::as_tibble() %>% gt::gt() %>% gt::gtsave(infp)

Error message:

Unknown output format doc
Pandoc can convert to DOCX, but not to DOC.
Error: pandoc document conversion failed with error 22

# Local folder
infp <- file.path("test.docx")
mtcars %>% tibble::as_tibble() %>% gt::gt() %>% gt::gtsave(infp)
mtcars %>% tibble::as_tibble() %>% gt::gt() %>% gt::gtsave(infp)

No problem

Expected result

The docx file should have been overwritten without error messages

Session info

> sessionInfo()
R version 4.5.0 (2025-04-11 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Matrix products: default
  LAPACK version 3.12.1

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

time zone: Europe/Rome
tzcode source: internal

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

other attached packages:
 [1] tidylog_1.1.0       magrittr_2.0.3      lubridate_1.9.4    
 [4] forcats_1.0.0       dplyr_1.1.4         purrr_1.0.4
 [7] readr_2.1.5         tidyr_1.3.1         tibble_3.2.1
[10] tidyverse_2.0.0     lme4_1.1-37         Matrix_1.7-3       
[13] glmmTMB_1.1.11      labelled_2.14.1     duckdb_1.3.0
[16] DBI_1.2.3           flextable_0.9.9     cobalt_4.6.0
[19] modelsummary_2.4.0  MatchIt_4.7.2       summarytools_1.1.4
[22] survival_3.8-3      survminer_0.5.0     ggpubr_0.6.0
[25] ggplot2_3.5.2       broom.mixed_0.2.9.6 formula.tools_1.7.1
[28] gtsummary_2.2.0     stringr_1.5.1       rlist_0.4.6.2
[31] glue_1.8.0          raffalib_0.1

loaded via a namespace (and not attached):
  [1] fs_1.6.6                matrixStats_1.5.0       devtools_2.4.5
  [4] RColorBrewer_1.1-3      insight_1.3.1           numDeriv_2016.8-1.1    
  [7] profvis_0.4.0           tools_4.5.0             backports_1.5.0
 [10] utf8_1.2.6              R6_2.6.1                sigmoid_1.4.0
 [13] mgcv_1.9-1              urlchecker_1.0.1        withr_3.0.2
 [16] gridExtra_2.3           performance_0.14.0.13   cli_3.6.5
 [19] textshaping_1.0.1       gt_1.0.0                pacman_0.5.1
 [22] officer_0.6.10          sandwich_3.1-1          marginaleffects_0.27.0
 [25] labeling_0.4.3          quickmatch_0.2.3        mvtnorm_1.3-3
 [28] arrow_20.0.0.2          survMisc_0.5.6          tables_0.9.31
 [31] askpass_1.2.1           scclust_0.2.5           systemfonts_1.2.3
 [34] R.utils_2.13.0          parallelly_1.45.0       sessioninfo_1.2.3      
 [37] rstudioapi_0.17.1       generics_0.1.4          car_3.1-3
 [40] zip_2.3.3               abind_1.4-8             R.methodsS3_1.8.2
 [43] lifecycle_1.0.4         multcomp_1.4-28         carData_3.0-5
 [46] grid_4.5.0              promises_1.3.3          crayon_1.5.3
 [49] miniUI_0.1.2            lattice_0.22-6          haven_2.5.5
 [52] magick_2.8.7            pillar_1.11.0           knitr_1.50
 [55] tcltk_4.5.0             boot_1.3-31             estimability_1.5.1     
 [58] clisymbols_1.2.0        codetools_0.2-20        fontLiberation_0.1.0
 [61] data.table_1.17.4       remotes_2.5.0           vctrs_0.6.5
 [64] Rdpack_2.6.4            gtable_0.3.6            assertthat_0.2.1
 [67] datawizard_1.1.0        cachem_1.1.0            xfun_0.52
 [70] rbibutils_2.3           mime_0.13               correlation_0.8.7
 [73] coda_0.19-4.1           reformulas_0.4.1        this.path_2.7.0
 [76] KMsurv_0.1-6            ellipsis_0.3.2          TH.data_1.1-3
 [79] nlme_3.1-168            usethis_3.1.0           bit64_4.6.0-1
 [82] fontquiver_0.2.1        rprojroot_2.0.4         TMB_1.9.17
 [85] tidyselect_1.2.1        emmeans_1.11.1          bit_4.6.0
 [88] compiler_4.5.0          xml2_1.3.8              desc_1.4.3
 [91] fontBitstreamVera_0.1.1 bayestestR_0.16.1.1     checkmate_2.3.2
 [94] scales_1.4.0            distances_0.1.12        digest_0.6.37
 [97] minqa_1.2.8             rmarkdown_2.29          htmltools_0.5.8.1
[100] pkgconfig_2.0.3         base64enc_0.1-3         openxlsx2_1.16
[103] fastmap_1.2.0           ggthemes_5.1.0          rlang_1.1.6
[106] htmlwidgets_1.6.4       pryr_0.1.6              shiny_1.10.0
[109] farver_2.1.2            zoo_1.8-14              jsonlite_2.0.0
[112] R.oo_1.27.1             rapportools_1.2         Formula_1.2-5
[115] parameters_0.26.0.16    Rcpp_1.0.14             gdtools_0.4.2
[118] furrr_0.3.1             stringi_1.8.7           chk_0.10.0
[121] nleqslv_3.3.5           MASS_7.3-65             plyr_1.8.9
[124] pkgbuild_1.4.8          parallel_4.5.0          listenv_0.9.1
[127] splines_4.5.0           pander_0.6.6            hms_1.1.3
[130] uuid_1.2-1              ggsignif_0.6.4          effectsize_1.0.1
[133] reshape2_1.4.4          pkgload_1.4.0           ahaz_1.15.1
[136] evaluate_1.0.4          operator.tools_1.6.3    nloptr_2.2.1
[139] tzdb_0.5.0              httpuv_1.6.16           cards_0.6.0
[133] reshape2_1.4.4          pkgload_1.4.0           ahaz_1.15.1
[136] evaluate_1.0.4          operator.tools_1.6.3    nloptr_2.2.1
[133] reshape2_1.4.4          pkgload_1.4.0           ahaz_1.15.1
[133] reshape2_1.4.4          pkgload_1.4.0           ahaz_1.15.1
[136] evaluate_1.0.4          operator.tools_1.6.3    nloptr_2.2.1
[139] tzdb_0.5.0              httpuv_1.6.16           cards_0.6.0
[142] openssl_2.3.3           future_1.58.0           km.ci_0.5-6
[145] cardx_0.2.4             broom_1.0.8             xtable_1.8-4
[148] rstatix_0.7.2           later_1.4.2             ragg_1.4.0
[151] memoise_2.0.1           timechange_0.3.0        globals_0.18.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions