Is there is any plugin to parse csv file for grails 3.1.1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is there is any plugin to parse csv file for grails 3.1.1

Ajay Shah-2
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there is any plugin to parse csv file for grails 3.1.1

Gregory Dickson
 compile 'com.xlson.groovycsv:groovycsv:1.1'



On Fri, Dec 16, 2016 11:10 AM, Ajay Shah [hidden email] wrote:
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/f849ed58-370c-f04b-663e-50f88d4c20e0%40mixmax.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there is any plugin to parse csv file for grails 3.1.1

Gregory Dickson
In reply to this post by Ajay Shah-2
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) {



On Fri, Dec 16, 2016 11:10 AM, Ajay Shah [hidden email] wrote:
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/9efa65d0-9ce2-2c04-2a6d-b397611bfbff%40mixmax.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there is any plugin to parse csv file for grails 3.1.1

Ajay Shah-2
In reply to this post by Ajay Shah-2
import static com.xlson.groovycsv.CsvParser.parseCsv

I had imported this to my contoller but unable to resolve xlson . It appears red. I had compiled the required dependency as you suggested but unable to import this class?
On Friday, December 16, 2016 at 10:40:11 PM UTC+5:30, Ajay Shah wrote:
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/47ce5189-0f63-4bdf-9097-0e242dee883b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there is any plugin to parse csv file for grails 3.1.1

Ajay Shah-2
thanks it solve my problem after resetting my project

On Fri, Dec 16, 2016 at 11:22 PM, Ajay Shah <[hidden email]> wrote:
import static com.xlson.groovycsv.CsvParser.parseCsv

I had imported this to my contoller but unable to resolve xlson . It appears red. I had compiled the required dependency as you suggested but unable to import this class?
On Friday, December 16, 2016 at 10:40:11 PM UTC+5:30, Ajay Shah wrote:
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 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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/47ce5189-0f63-4bdf-9097-0e242dee883b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAFcL%3D6noWdnaR1xYVrjEzAgKnPLbBXw2J1p%2B%2BfgioDSOryz3kQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...