1

I' am trying to export folder names and read .xlsx files under the folder. When i come across to polish folders due to special characters R cannot read it. Any help? Here is the example. I can read the file in a normal folder name.

my_data1 <- read_excel("C:/data/Projects/Credit File conversion/Poland/Data_test/Credit upload file_Q42019 .xlsx")
> New names:
> * `` -> ...2
> * `` -> ...3
> * `` -> ...4
> * `` -> ...5
> * `` -> ...6
> * ... and 1 more problem

And when I try to read it under the folder SUWAŁA.

Sys.setlocale("LC_ALL", "Polish")

my_data2 <- read_excel("C:/data/Projects/Credit File conversion/Poland/Data_test/SUWAŁA/Credit upload file_Q42019 .xlsx")

Error: Evaluation error: zip file 'C:\data\Projects\Credit File conversion\Poland\Data_test\SUWAŁA\Credit upload file_Q42019 .xlsx' cannot be opened.

OTStats
  • 1,820
  • 1
  • 13
  • 22
Maurice
  • 11
  • 2
  • The Polish folder has special character encodings that you need to read in a certain way. This question is answered here: https://stackoverflow.com/a/28461726/7120715 – bstrain Jun 30 '20 at 14:49
  • Welcome to stack overflow. Avoid spaces in the path. For my part `read.table("/tmp/SUWAŁA/test.csv")` works fine with a `en_US` locale. Notice also that the error message is that the file cannot be opened, it does not say that it hasn't found the file. – DJJ Jun 30 '20 at 20:59
  • @DJJ I cannot transform the xlsx files into csv before read it. I have a funtion that read 3 000 of files in different polish folder names. transform the unstructered data there to structured data for modeling. – Maurice Jul 01 '20 at 06:29
  • @bstrain it's not the special character encoding in the files that caused the problem. it's the folder name. this example of folder : SUWAŁA where the xlsx file was in. – Maurice Jul 01 '20 at 06:31
  • My point was not about the xls but the path and folder names. I was showing that Polish special characters in the path works. I just don't use xls files in R. I'm afraid cannot help more than that given the information you provided. Start with a simple path like I did first. HTH – DJJ Jul 01 '20 at 19:56

0 Answers0