DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Andrew has posted 6 posts at DZone. View Full User Profile

Manipulate Excel Fields

  • submit to reddit
        // This code makes it easy to take multiple Excel fields and make them however many fields you want. First save the Excel file as CSV.

import csv
reader = csv.reader(open("absolute path to CSV file"), dialect='excel')
for row in reader:
   firstname = row[0]
   lastname = row[1]

   ## Then you can take the fields and arrange them however you want.
   ## Copy and paste them however you'd like.
   print firstname, lastname