Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 729013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:44:53+00:00 2026-05-14T06:44:53+00:00

How to read and import .csv file in groovy on grails. I have .csv

  • 0

How to read and import .csv file in groovy on grails. I have .csv file with data and
need to import in to db using user interface .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:44:54+00:00Added an answer on May 14, 2026 at 6:44 am

    There are as always different possibilities to work with CSV files in Groovy.

    As Groovy is fully interoperable with Java, you can use one of the existing CSV libararies, e.g. OpenCSV.

    Depending on the complexity of the CSV file you are using, you can also use the standard file/string handling possibilities of Groovy:

    def sql = Sql.newInstance("jdbc:mysql://localhost:3306/mydb",
      "user", "pswd", "com.mysql.jdbc.Driver")
    def people = sql.dataSet("PERSON")
    new File("users.csv").splitEachLine(",") {fields ->
      people.add(
        first_name: fields[0],
        last_name: fields[1],
        email: fields[2]
      )
    }
    

    EDIT:
    Kelly Robinson just wrote a nice blog post about the different possibilities that are available to work with CSV files in Groovy.

    EDIT #2:
    As Leonard Axelsson recently released version 1.0 of his GroovyCVS library, I thought I should definitely add this to the list of options.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small script we're using to read in a CSV file containing
I'm writing a simple import application and need to read a CSV file, show
I have a csv file like 120 column by 4500 row. I read the
is it possible to programmatically have access open a certain csv file and read
I have a large file, with 1.8 million rows of data, that I need
I want to read in a csv file, filter it based on the values
im reading a csv file and then writing a new one: import csv with
I'm trying to load a default set of data from a csv file into
I need to write model data ( CharField s only) to an XML file
Ok so I am trying to import a csv which I need to insert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.