Long time reader, first time writter...
Im writting some R code that shall take some data input from other sources. One place can only give data as a .xls format. While there is good excel capabilities in R, this .xls file cannot be read from R. But if i convert it to .xlsx R handels it fine. So im gonna convert it.
In a direct cmd input, i cann convert it by doing as below:
"C:/Program Files (x86)/Microsoft Office/root/Office16/excelcnv.exe" -oice "C:/Users/my_name/OneDrive - work/Documents/Dashboard code/New Code/work_STD_TEMPLATE.xls""C:/Users/my_name/OneDrive - work/Documents/Dashboard code/New Code/work_STD_TEMPLATE2.xlsx"
But I wish to automate the code, so implementing this would be best. See below for the version i can compile and run.
R-code:
args = c("C:/Program Files (x86)/Microsoft Office/root/Office16/excelcnv.exe" ,
'-oice' , "C:/Users/my_name/OneDrive - work/Documents/Dashboard code/New Code/work_STD_TEMPLATE.xls" , "C:/Users/my_name/OneDrive - work/Documents/Dashboard code/New Code/work_STD_TEMPLATE2.xlsx");
system2(args)
But while it runs it stalls the system and finally promts a pop-upbox that tells me:
excelcnv.exe - Application Error The application was unable to start correctly (0x0000142).
I need big brain person for this. Thanks in advance
Found answer last night:
args = "\"C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\excelcnv.exe\" -oice \"C:\\Users\\my_name\\OneDrive - work\\Documents\\Dashboard code\\New Code\\work_STD_TEMPLATE.xls\" \"C:\\Users\\my_name\\OneDrive - work\\Documents\\Dashboard code\\New Code\\work_STD_TEMPLATE2.xlsx\""
system("cmd.exe" , input = args)
I needed to escape charterer the escape characters... so \ had to be \ and " had to be \"