Create new CSV from specific columns in existing CSV

jtouchais

New Member
Joined
Jun 7, 2018
Messages
1
Hi Experts!

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

I have dabbled a little in VBA but it was a long time ago. Moreover i am not familiar with CSV and it's text strings instead of ranges...

Help please! :)

PS - below is the mapping I did of the headers for reference.
ORDER_EXPORTSHIPPER_CSV
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
recipient_name
Shipping Street
recipient_street1
Shipping Address1
recipient_house_no
Shipping Address2
recipient_street2
Shipping Company
recipient_name2
Shipping City
recipient_city
Shipping Zip
recipient_zip
Shipping Province
recipient_state
Shipping Country
recipient_country
Shipping Phone
recipient_phone
Notes
recipient_comment
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
recipient_language_code
recipient_fax
recipient_type

<tbody>
</tbody>
 

Some videos you may like

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Watch MrExcel Video

Forum statistics

Threads
1,114,084
Messages
5,545,863
Members
410,711
Latest member
Josh324
Top