Python Forum
.csv export, map and create new .csv
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.csv export, map and create new .csv
#1
Hi Experts!

After trying to "play" with VB and Excel and searching high and low for a suitable solution I discovered Python was probably the answer to my problem!
BIG caveat: I'm a total noob when it comes to coding!

Anyway, i was hoping someone out there had a similar issue and solved it already :)

Here goes:
I have an order export from my store producing a CSV file with set columns that I cannot change prior to the export (ORDER_EXPORT)
My warehouse requires a csv file in order to receive the orders with a different set of columns (headers and order of the data) (SHIPPER_CSV)

What I would need is a script that:
1. map the headers correctly (e.g. Shipping Name > recipient_name)
2. imports the data from ORDER_EXPORT to the correct SHIPPER_CSV columns
3. if ORDER_EXPORT header "Shipping Company" is not blank then SHIPPER_CSV "recipient_type" = B else SHIPPER_CSV "recipient_type" = C
3. saves SHIPPER_CSV as a .csv that can be imported

Is this something easily doable?

Help please!

PS - below are the headers
ORDER-EXPORT
Name
Email
Financial Status
Paid at
Fulfillment Status
Fulfilled at
Accepts Marketing
Currency
Subtotal
Shipping
Taxes
Total
Discount Code
Discount Amount
Shipping Method
Created at
Lineitem quantity
Lineitem name
Lineitem price
Lineitem compare at price
Lineitem sku
Lineitem requires shipping
Lineitem taxable
Lineitem fulfillment status
Billing Name
Billing Street
Billing Address1
Billing Address2
Billing Company
Billing City
Billing Zip
Billing Province
Billing Country
Billing Phone
Shipping Name
Shipping Street
Shipping Address1
Shipping Address2
Shipping Company
Shipping City
Shipping Zip
Shipping Province
Shipping Country
Shipping Phone
Notes
Note Attributes
Cancelled at
Payment Method
Payment Reference
Refunded Amount
Vendor
Id
Tags
Risk Level
Source
Lineitem discount
Tax 1 Name
Tax 1 Value
Tax 2 Name
Tax 2 Value
Tax 3 Name
Tax 3 Value
Tax 4 Name
Tax 4 Value
Tax 5 Name
Tax 5 Value
Phone

SHIPPER_CSV
recipient_reference
recipient_email
recipient_name
recipient_street1
recipient_house_no
recipient_street2
recipient_name2
recipient_city
recipient_zip
recipient_state
recipient_country
recipient_phone
recipient_comment
recipient_language_code
recipient_fax
recipient_type
Reply


Messages In This Thread
.csv export, map and create new .csv - by jtouchais - Jun-07-2018, 08:06 AM
RE: .csv export, map and create new .csv - by buran - Jun-07-2018, 08:20 AM
RE: .csv export, map and create new .csv - by buran - Jun-07-2018, 08:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to create synonyms of a word and export them to csv in different columns vijaymadhu 1 3,081 Jun-23-2017, 06:31 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020