compile 'com.xlson.groovycsv:groovycsv:1.1'
|
I just want to parse csv file to retrive information from it and use it to update my database accordingly. Is there is any easy way to do this .If not then plain groovy code will be helpful beacuse i tried alot but i had failed to do so.
--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/fdc10f3d-4b1e-41e9-9d4e-de8ceab6d547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
some Controller Code: import static com.xlson.groovycsv.CsvParser.parseCsv def uploaddetail(){ if (request.method == 'POST') { def submittedFile = request.getFile('file') if (submittedFile.empty) { flash.message = 'File is mandatory.' response.sendError(500) } else { if (!(submittedFile.getContentType() == 'application/csv' || submittedFile.getContentType() == 'text/csv')) { flash.message = 'File must have a CSV extension.' response.sendError(500) } else { def data = parseCsv(submittedFile.getInputStream().getText() def count = 0 for (row in data) {
|
I just want to parse csv file to retrive information from it and use it to update my database accordingly. Is there is any easy way to do this .If not then plain groovy code will be helpful beacuse i tried alot but i had failed to do so.
--
import static com.xlson.groovycsv.CsvParser.parseCsv
--
You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grails-dev-discuss/kKLcMzWKvao/unsubscribe.
To unsubscribe from this group and all its topics, send an email to grails-dev-discuss+unsub...@googlegroups.com.
To post to this group, send email to grails-dev-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/47ce5189-0f63-4bdf-9097-0e242dee883b%40googlegroups.com.