Import orders from xls/csv to drupal commerce I am trying to import orders from xls file to drupal commerce store.Is there any existing module for this, I found commerce_migrate and commerce_feeds module I am not sure if they can be helpful here could not find if any of the two module provides this functionality as not mentioned on project page.
I wrote a script to import orders. Here is the workflow I followed


imported all users using user_import module, the orders belongs to.
Created a custom database tables with columns needed to make an order.
Imported the excel/csv file to custom table after formating data.
Created a script to import orders and create customer profile linked to a order


Here is the script

/*
 * Helper function to facilate order import functinality.
 */

function mymodule_name_order_import_($email, $product_sku, $order_created_date, $quantity, $status, $billing_fields, $payment_method) {

  // Get product id.
  $product = commerce_product_load_by_sku($product_sku);
  $product_id = $product-&gt;product_id;

  $user = user_load_by_mail($email);
  $uid = $user-&gt;uid;

  if (!empty($uid)) {

    // Set order status.
    if ($status == "Pending") {
      $status = "pending";
    }if ($status == "Completed") {
      $status = "completed";
    }

    // Keeping order status to pending. -- Need to Change as per order. -- 
    $order = commerce_order_new($uid, $status);

// Save the order so its ID is assigned.
    commerce_order_save($order);

// Order created date in time stamp.
    $date = DateTime::createFromFormat('m/d/Y', $order_created_date);
    $order-&gt;created = $date-&gt;getTimestamp();

    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);

//add products to order by ids array
    $product = commerce_product_load($product_id);

// Create a line item with quantity 1 and this product.
    $line_item = commerce_product_line_item_new($product, $quantity, $order-&gt;order_id);

// Save the line item to get its ID.
    commerce_line_item_save($line_item);

// Add the line item to the order using the wrapper.
    $order_wrapper-&gt;commerce_line_items[] = $line_item;

// Get Billing Profile.
    $profile_billing = mymodule_name_order_import_map_billing_fields($uid, $billing_fields);

// Map billing address to order.
    $order-&gt;commerce_customer_billing[LANGUAGE_NONE][0]['profile_id'] = $profile_billing-&gt;profile_id;

// Get Shipping Profile.
    $profile_shipping = mymodule_name_order_import_map_shipping_fields($uid, $billing_fields);

// Map billing address to order.
    $order-&gt;commerce_customer_shipping[LANGUAGE_NONE][0]['profile_id'] = $profile_shipping-&gt;profile_id;

// Payment Method
    if ($product_sku == "25PDVDP") {
      $order-&gt;data['payment_method'] = "payment_commerce_2|commerce_payment_payment_commerce_2";
    }
    elseif ($product_sku != "25PDVDP") {
      if ($payment_method == "Credit Card") {
        $order-&gt;data['payment_method'] = "credit_cart|custom_import";
      }
      if ($payment_method == "PayPal") {
        $order-&gt;data['payment_method'] = "paypal|custom_import";
      }
      else {
        $order-&gt;data['payment_method'] = "na|custom_import";
      }
    }

// Save the order.
    commerce_order_save($order);
  }
  else {
    print "This user doesn't exists : " . $email;
  }
}

/**
 * Helper function to map billing fields.
 * @param $uid user id of user to make billing profile for.
 */
function mymodule_name_order_import_map_billing_fields($uid, $billing_fields) {
  $profile_billing = commerce_customer_profile_new('billing', $uid);
  $profile_billing-&gt;commerce_customer_address = array(
    LANGUAGE_NONE =&gt; array(
      0 =&gt; addressfield_default_values()
    )
  );

// Full Name(Required)
  $profile_billing-&gt;commerce_customer_address[LANGUAGE_NONE][0]['name_line'] = $billing_fields['name_line'];

// Country(Required)
  $profile_billing-&gt;commerce_customer_address[LANGUAGE_NONE][0]['country'] = $billing_fields['country'];

// Address 1(Required)
  $profile_billing-&gt;commerce_customer_address[LANGUAGE_NONE][0]['thoroughfare'] = $billing_fields['thoroughfare'];

// Address 2
  $profile_billing-&gt;commerce_customer_address[LANGUAGE_NONE][0]['premise'] = $billing_fields['premise'];

// City(Required)
  $profile_billing-&gt;commerce_customer_address[LANGUAGE_NONE][0]['locality'] = $billing_fields['locality'];

// State(Required)
  $profile_billing-&gt;commerce_customer_address[LANGUAGE_NONE][0]['administrative_area'] = $billing_fields['administrative_area'];

// Postal Code(Required)
  $profile_billing-&gt;commerce_customer_address[LANGUAGE_NONE][0]['postal_code'] = $billing_fields['postal_code'];

//Business name(Required)
  $profile_billing-&gt;field_business_name[LANGUAGE_NONE][0]['value'] = $billing_fields['field_business_name'];

// Who runs your front desk?(Required)
  $profile_billing-&gt;field_who_runs_your_front_desk_[LANGUAGE_NONE][0]['value'] = $billing_fields['field_who_runs_your_front_desk_'];

// Email address for the front desk person(Required)
  $profile_billing-&gt;field_email_address_front_desk[LANGUAGE_NONE][0]['value'] = $billing_fields['field_email_address_front_desk'];

// Phone(Required)
  $profile_billing-&gt;field_phone[LANGUAGE_NONE][0]['value'] = $billing_fields['field_phone'];

// Save billing profile.
  commerce_customer_profile_save($profile_billing);

  return $profile_billing;
}

/**
 * Helper function to map billing fields.
 * @param $uid user id of user to make shipping profile for.
 */
function mymodule_name_order_import_map_shipping_fields($uid, $billing_fields) {
  $profile_shipping = commerce_customer_profile_new('shipping', $uid);
  $profile_shipping-&gt;commerce_customer_address = array(
    LANGUAGE_NONE =&gt; array(
      0 =&gt; addressfield_default_values()
    )
  );

// Full Name(Required)
  $profile_shipping-&gt;commerce_customer_address[LANGUAGE_NONE][0]['name_line'] = $billing_fields['name_line'];

// Country(Required)
  $profile_shipping-&gt;commerce_customer_address[LANGUAGE_NONE][0]['country'] = $billing_fields['country'];

// Address 1(Required)
  $profile_shipping-&gt;commerce_customer_address[LANGUAGE_NONE][0]['thoroughfare'] = $billing_fields['thoroughfare'];

// Address 2
  $profile_shipping-&gt;commerce_customer_address[LANGUAGE_NONE][0]['premise'] = $billing_fields['premise'];

// City(Required)
  $profile_shipping-&gt;commerce_customer_address[LANGUAGE_NONE][0]['locality'] = $billing_fields['locality'];

// State(Required)
  $profile_shipping-&gt;commerce_customer_address[LANGUAGE_NONE][0]['administrative_area'] = $billing_fields['administrative_area'];

// Postal Code(Required)
  $profile_shipping-&gt;commerce_customer_address[LANGUAGE_NONE][0]['postal_code'] = $billing_fields['postal_code'];

// You sould pass the entire $profile object as parameter.
  commerce_customer_profile_save($profile_shipping);

  return $profile_shipping;
}

function jh_order_import_run($jh_product_sku = '') {

  //$jh_product_sku = '25PDVDP';
  $result = db_select('jh_order_import', 'joi')-&gt;fields('joi')-&gt;condition('product_sku', $jh_product_sku, '=')-&gt;execute()-&gt;fetchAll();

  foreach ($result as $key =&gt; $value) {
    echo "&lt;pre&gt;";
    print_r($value);
    $country = array('United States' =&gt; 'US', 'Canada' =&gt; 'CA',
      'Australia' =&gt; 'AU', 'United Kingdom' =&gt; 'GB', 'South Africa' =&gt; 'ZA');
    $jh_bill = array('name_line' =&gt; $value-&gt;full_name, 'country' =&gt; $country[$value-&gt;country],
      'thoroughfare' =&gt; $value-&gt;billing_address_1,
      'premise' =&gt; $value-&gt;billing_address_2,
      'locality' =&gt; $value-&gt;billing_city,
      'administrative_area' =&gt; $value-&gt;billing_state,
      'postal_code' =&gt; $value-&gt;billing_postal_code,
      'field_business_name' =&gt; $value-&gt;billing_bussiness_name,
      'field_who_runs_your_front_desk_' =&gt; $value-&gt;billing_front_desk_name,
      'field_email_address_front_desk' =&gt; $value-&gt;billing_front_desk_email,
      'field_phone' =&gt; $value-&gt;billing_phone,
    );
    $payment_method = $value-&gt;payment_methods;
    mymodule_name_order_import_($value-&gt;email, $value-&gt;product_sku, $value-&gt;order_date, $value-&gt;quantity, $value-&gt;status, $jh_bill, $payment_method);
    print "imported " . $key;
  }
}


NOTE: the above script is use case specific, so it will need modifications per need, but might be helpful to start with. I am using drupal commerce API's to import orders, customer profiles that's all.