I have a CSV file seperated by ; which i need to convert in xlsx using R
I am able to convert it but only issue i found in the output file is that there is a semicolon(;) inbetween data column like "Material Description" "CONNECTION SET PP G5/8-HOSE6/12;10/16" due to which the data is getting split in between columns which is creating an issue as attached in the image.
Is there any way to handle such scenario which generally occurs due to bad data entry
There are 1-2 lines with such issues , is there any way to fix this issue before creating the dataframe.??
Output of R code - Data getting split in columns:
Coding efforts of the TO:
library(xlsx)
library(xlsxjars)
library(openxlsx)
ab<-read.csv2("C:/Path/Jan-2020.csv",sep = ";",quote = "")
ab<-as.data.frame(sapply(ab,function(x) gsub('"','',x)))
ab<-as.data.frame(sapply(ab,function(x) gsub(',,,','',x)))
ab<-as.data.frame(sapply(ab,function(x) gsub(',,','',x)))
ab<-as.data.frame(sapply(ab,function(x) gsub('#','',x)))
question from:
https://stackoverflow.com/questions/65950933/convert-semicolon-seperated-csv-file-to-xlsx-using-r 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…