我有一个CSV文本文件让我头疼。文件本身很安静。下面是该文件的示例及其中的问题。注释部分中的回车符打破了CSV结构,导致在Excel中导入数据时出现问题。我该如何解决这个问题?
"DataId" "mpi_id" "pt_enct_no" "DataElementId" "DataValue" "CreateDate" "Active" "CreateBy"
"1675167619" "205346" "7" "730" "N" "5/10/2017 12:12:45 AM" "Y" "cry6707 "
"1675167620" "205346" "7" "733" "N" "5/10/2017 12:12:45 AM" "Y" "cry6707 "
"1675167621" "205346" "7" "734" "N" "5/10/2017 12:12:45 AM" "Y" "cry6707 "
"1675167622" "205346" "7" "739" "N" "5/10/2017 12:12:45 AM" "Y" "cry6707 "
"1675167623" "205346" "7" "741" "8" "5/10/2017 12:12:45 AM" "Y" "cry6707 "
"1675167624" "205346" "7" "732" "Patient glasgow coma scale is 13 or greater. " "5/10/2017 12:12:45 AM" "Y" "cry6707 "
"1675167625" "205346" "7" "731" "No facial asymmetry/weakness noted.
" "5/10/2017 12:12:45 AM" "Y" "cry6707 "
"1675167626" "205346" "7" "735" "No lingual asymmetry/weakness noted.
" "5/10/2017 12:12:45 AM" "Y" "cry6707 "
"1675167627" "205346" "7" "740" "No palatal asymmetry/weakness noted.
" "5/10/2017 12:12:45 AM" "Y" "cry6707 "
"1675167628" "205346" "7" "736" "Patient passed the Dysphagia Screening.
Patient glasgow coma scale is 13 or greater.
No facial asymmetry/weakness noted. No lingual asymmetry/weakness noted. No palatal asymmetry/weakness noted.
" "5/10/2017 12:12:45 AM" "Y" "cry6707 "
答案 0 :(得分:0)
在Notepad ++或SublimeText等文本编辑器中打开csv文件,并用文件中不存在的字符替换换行符,例如|
。然后,您将能够在Excel中打开它而不会出现结构问题。
答案 1 :(得分:0)
我找到了解决此问题的方法。我首先将文件导入到Excel中,然后将其导出到Excel,而不是先将文件导入Excel,确保将长注释字段定义为长文本字段。它就像一个魅力。