CSV input -- Formatted output

Joined
Jan 18, 2012
Messages
3
Reaction score
0
Hi,

I am trying to physically print letters, envelopes, labels and invoices from an ebay csv file. I can print the whole file to my screen but I can't get to the fields individually to format the printed material I listed above. I have tried using lines and csv.reader. Here are some of the fields I have to work with:
SALES RECORD...USER ID...BUYER FULLNAME...BUYER PHONE NUMBER...BUYER EMAIL...BUYER ADDRESS 1....etc..

I have tried many ways, sometimes I got some data to print. After I get selected fields to the screen then I want to print invoices.
Here's the latest failure:

import csv
infile = csv.reader(open("fileexchange_response_123456789.csv", "rb"))
for 'sales record', 'user id', 'buyer fullname', 'buyer phone number' in reader:
print 'sales record', 'user id', 'buyer fullname', 'buyer phone number'
infile.close()

Any comment would be appreciated.
Thanks, Dave
 
Joined
Jan 18, 2012
Messages
3
Reaction score
0
Made some progess but I still need HELP

I got this to dump out the header record and all the detail records nicely.
I like the Reader because it cleans up the numeric fields.
I still need to test a field or fields and then print fields that I select.
What can I add to accomplish this?
I will keep reading and testing. Thanks, Dave

import csv
rdr= csv.reader( open("fileexchange_response_12458229.csv", "rb" ) )
print 'FILE BEGINS ************************************************'
for row in rdr:
print 'ROW BEGINS'
# I would like to test a field or fields here
# and print multiple fields here
print row
print 'ROW ENDS'
print 'FILE ENDS ***************************************************'


FILE BEGINS ************************************************
ROW BEGINS
['Sales Record Number', 'User Id', 'Buyer Fullname', 'Buyer Phone Number', 'Buye
r Email', 'Buyer Address 1', 'Buyer Address 2', 'Buyer City', 'Buyer State', 'Bu
yer Zip', 'Buyer Country', 'Order ID', 'Item ID', 'Transaction ID', 'Item Title'
, 'Quantity', 'Sale Price', 'Shipping And Handling', 'Sales Tax', 'Insurance', '
Total Price', 'Payment Method', 'PayPal Transaction ID', 'Sale Date', 'Checkout
Date', 'Paid on Date', 'Shipped on Date', 'Shipping Service', 'Feedback Left', '
Feedback Received', 'Notes to Yourself', 'Custom Label', 'Listed On', 'Sold On',
'Variation Details']
ROW ENDS
ROW BEGINS
real data records not shown
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top