Comments (6)
Thanks. I will look at this soon.
Note to self: readxl
uses SET_STRING_ELT(cols[7], c, Rf_mkCharCE("text", CE_UTF8));
but when I tried this before, Encoding()
still returned "unknown"
. I want to avoid Encoding() <- "UTF-8"
because it copies potentially huge vectors/dataframes.
from tidyxl.
@stla If you have "Stéphane" in a cell, does that print correctly?
from tidyxl.
No, there's the same issue in the cells. For example "é"
and "µ"
below.
> x$data$Sheet1[,"character"]
# A tibble: 8 × 1
character
<chr>
1 A
2 B
3 é
4 <NA>
5 <NA>
6 µ
7 <NA>
8 <NA>
from tidyxl.
Please can you test the latest version.
from tidyxl.
Looks perfect 👍
json <- jsonlite::fromJSON("{\"a\":[\"µ\",null,2],\"é\":[\"c\",4]}", simplifyVector=FALSE)
jsoncomments <- jsonlite::fromJSON("{\"a\":[\"Stéphane\",null,null],\"é\":[null,\"bye\"]}", simplifyVector=FALSE)
library(openxlsx)
headerStyle <- createStyle(textDecoration = "Bold", border="Bottom")
wb <- createWorkbook()
addWorksheet(wb=wb, sheetName = "Sheet1")
addStyle(wb, sheet="Sheet1", style=headerStyle, rows=1, cols=seq_along(json))
for(j in seq_along(json)){
writeData(wb, sheet="Sheet1", x=names(json)[j], startRow=1L, startCol=j)
column <- json[[j]]
comments <- jsoncomments[[j]]
for(i in seq_along(column)){
writeData(wb, sheet="Sheet1", x=column[[i]], startRow=i+1L, startCol=j)
if(!is.null(comment <- comments[[i]])){
writeComment(wb, sheet="Sheet1", col=j, row=i+1L,
comment=createComment(comment=comment, visible=FALSE))
}
}
}
saveWorkbook(wb, "test001.xlsx", overwrite = TRUE)
txl <- tidyxl::tidy_xlsx("test001.xlsx", sheets=1)
> txl$data$Sheet1[,c("character","comment")]
character comment
1 a <NA>
2 é <NA>
3 µ Stéphane
4 c <NA>
5 <NA> bye
6 <NA> <NA>
from tidyxl.
Thanks!
from tidyxl.
Related Issues (20)
- Read in openxlsx workbooks with xlsx_cells() HOT 2
- Can you make R Makevars specify gcc? ipcc fails. HOT 9
- Change licence to MIT HOT 3
- Encoding issue when using cell references on Windows 10 HOT 9
- Formulas referring to other files HOT 2
- 1.234, once formated as currency is imported as numeric 1.23 instead of numeric 1.234 HOT 5
- R Studio crashes reading file HOT 11
- apply* formats should default to false HOT 2
- How to import data from a URL? HOT 1
- Identify Grouped Rows in Excel HOT 10
- Identifying pivot tables in sheets HOT 1
- special characters in file path HOT 3
- select sheet in xlsx_formats() HOT 2
- Hidden columns sometimes cause R session to crash with calling tidyxl::xlsx_cells() HOT 1
- create xlsx from xlsx_cells HOT 1
- Readme doesn't show gif on pkgdown site HOT 1
- Hexcodes for colors are strange/incorrect HOT 4
- xlsx_formats for sheets in an xlsx file HOT 1
- `xlsx_cells(include_blank_cells = FALSE)` fails on blank cells with comments
- Cells incorrectly identified as blank HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tidyxl.