CSV File multiple upload

This is the place for queries that don't fit in any of the other categories.

CSV File multiple upload

Postby r32vdub » Tue May 14, 2013 10:57 pm

Hello,

I am trying to write a simple python program to load multiple .CSV files to be copied and re-outputted via CSV.

So far I have got the program to upload a single CSV file and output it where the user specifies via a save dialog box (just copies the file for now).

A dialog box pops up and asks to select files (multiple selection works) but i am not sure on how to save this multiple input of CSV files statically to an assigned location on my computer (C:/).

Here's a simple run down of the program task:

input CSV files -> copy -> output CSV files to static location on computer

I will attach my code to this post,

Any help is greatly appreciated!! :-) :D
Attachments
CSV_COPY.txt
(608 Bytes) Downloaded 27 times
r32vdub
 
Posts: 1
Joined: Tue May 14, 2013 10:36 pm

Re: CSV File multiple upload

Postby metulburr » Tue May 14, 2013 11:45 pm

just use code tags and insert your code into them instead of uploading a file
r32vdub wrote:
Code: Select all
#FILE UPLOAD

from Tkinter import Tk
from tkFileDialog import askopenfilenames

Tk().withdraw()
filenames = askopenfilenames()
print(filenames)


#FILE COPY/MANIPULATION

import csv
import tkFileDialog
 
ifile  = open(filenames)
reader = csv.reader(ifile)

#SAVE AS DIALOG BOX

ofile  = tkFileDialog.asksaveasfilename()
print filenames 

writer = csv.writer(open(ofile, 'wb'))

for row in reader:
    writer.writerow(row)
 


#STATUS DIALOG BOX

import tkMessageBox
tkMessageBox.showinfo(title="Conversion Successful", message="CSV File has been successfully converted")
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 13.04, Mint 11, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1096
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 5 guests