Created
November 12, 2017 15:58
-
-
Save bardware/1f6589b28842d64f7df148a03199ac44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/package-summary.html ---> | |
<cfset oCSV = createobject( "java", "org.apache.commons.csv.CSVFormat" )> | |
<cfset oParserObj = createobject( "java", "org.apache.commons.csv.CSVParser" )> | |
<cfdump var="#oParserObj#" expand="false"> | |
<cfset oIOFile = createobject( "java", "java.io.File" ).init( expandpath( "./CLIENTIMPORT.csv" ) )> | |
<cfset oCharset = createobject( "java", "java.nio.charset.StandardCharsets" )> | |
<cfset oFormat = oCSV.EXCEL.withDelimiter( "|").withFirstRecordAsHeader().withQuote(javacast("char","")).withRecordSeparator("\r\n")> | |
<cfdump var="#oIOFile#" expand="false"> | |
<cfdump var="#oCharset#"> | |
<cfdump var="#oFormat#" expand="false"> | |
<cfset oParser = oParserObj.parse( | |
oIOFile, | |
oCharset.UTF_8, | |
oFormat | |
)> | |
<cfdump var="#oParser#" expand="false" label="oParser"> | |
<cfdump var="#oParser.getHeaderMap()#"> | |
<cfset arrRecords = oParser.getRecords()> | |
<cfdump var="#arrRecords#"> | |
<cfloop array="#arrRecords#" index="oRecord"> | |
<cfdump var="#oRecord.toMap()#"> | |
</cfloop> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment