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>
 

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.

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top