Title: Adding Rows into a Repeater Programatically (CSV of Data)
Last modified: August 21, 2016

---

# Adding Rows into a Repeater Programatically (CSV of Data)

 *  [DigitalOneOne](https://wordpress.org/support/users/digitaloneone/)
 * (@digitaloneone)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/adding-rows-into-a-repeater-programatically-csv-of-data/)
 * **As a note, I am just bulk importing into a single post.**
 * I currently have a CSV with over 500 values. I want to add a bunch of new rows
   with the data, and was wondering if there’s a way to programmatically be able
   to do this?
 * I created a Java program to handle the creation of code I need. See below.
 * Here’s my code:
 * **Main.java**
 *     ```
       public static void main(String[] args) throws FileNotFoundException, IOException {
               CSVReader reader = new CSVReader(new FileReader("data.csv"));
               String [] nextLine;
               int count = 0;
               while ((nextLine = reader.readNext()) != null) {
                   // nextLine[] is an array of values from the line
                   Handler data = new Handler(nextLine, count);
                   appendToFile(data, "results.txt");  // append data to end of a text file
                   count++;
               }
           }
       ```
   
 * **Handler.java**
 *     ```
       Private String lat, long;
       Private int count;
   
       public Handler(String[] line, int count) {
       	this.count = count;
       	if (line != null) {
       		for (int i = 0; i < line.length; i++) {
       			if (line[i] != null) {
       				switch(i) {
       					case 1: this.lat = line[0]; break;
       					case 2: this.long = line[1]; break;
       					default: break;
       				}
       			} else {
       				line[i] = "";
       			}
       		}
       	}
       }
   
       Public String toString() {
       	String repeater = "latlng_repeater"; //repeater field name
       	String value_lat = "latlng_repeater_item_lat"; // sub field name
       	String value_long = "latlng_repeater_item_long"; // sub field name
   
       	String repeater_field_key = "field_53cf18c22ee37; // repeater field key
       	String value_lat_field_key = "field_53cf19022ee3b"; // lat field key
       	String value_lat_field_key = "field_53d09ad6527ac"; // long field key
   
       	String post_id = "248";
   
       	String result = ""; // create code for insertion
       	return result;
       }
       ```
   
 * [https://wordpress.org/plugins/advanced-custom-fields/](https://wordpress.org/plugins/advanced-custom-fields/)

The topic ‘Adding Rows into a Repeater Programatically (CSV of Data)’ is closed 
to new replies.

 * ![](https://ps.w.org/advanced-custom-fields/assets/icon.svg?rev=3207824)
 * [Advanced Custom Fields (ACF®)](https://wordpress.org/plugins/advanced-custom-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields/reviews/)

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)
 * [importing](https://wordpress.org/support/topic-tag/importing/)
 * [repeater field](https://wordpress.org/support/topic-tag/repeater-field/)

 * 0 replies
 * 1 participant
 * Last reply from: [DigitalOneOne](https://wordpress.org/support/users/digitaloneone/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/adding-rows-into-a-repeater-programatically-csv-of-data/)
 * Status: not resolved