Jump to content

Export addresses to Google Contacts


Nelly111s

Recommended Posts

I've wanted for a short while to export customer contact information into Google Contacts. From there, I can easily use the contact information in Quickbooks, my accounts package. I have cPanel access and using that and the phpMyAdmin, I went into the database and using the SQL below produced a query which I exported as a csv and imported without issue into. Google contacts. The SQL is below, should anyone wish to use it. I'm not a programmer etc - I learnt SQL ages ago briefly and it may be very crap code, but it works. Please don't ask me "how do I do this", "how do I modify to do this". I don't have the time to fix my own Cubecart site, never mind yours, so this code if offered as a service to those with the knowledge to use it.

If you don't know how to do this, don't use this code! 

 

SELECT DISTINCT
    CONCAT(T1.first_name, ' ', T1.last_name) AS 'Name',
    T1.first_name AS 'Given Name',
    T1.last_name AS 'Family Name',
    '' AS Notes,
    'Wooden Stuff ::: * myContacts' AS `Group Membership`,
    '* Work' AS `E-mail 1 - Type`,
    T1.email AS `E-mail 1 - Value`,
    'Mobile' AS `Phone 1 - Type`,
    T1.mobile AS `Phone 1 - Value`,
    'Home' AS `Phone 2 - Type`,
    T2.phone AS `Phone 2 - Value`,
    '' AS `Address 1 - Type`,
    '' AS `Address 1 - Formatted`,
    CONCAT(T2.line1, ', ', T2.line2) AS 'Address 1 - Street',
    T2.town AS `Address 1 - City`,
    '' AS `Address 1 - PO Box`,
    T2.state AS `Address 1 - Region`,
    T2.postcode AS `Address 1 - Postal Code`,
    'United Kingdom' AS `Address 1 - Country`,
    '' AS `Address 1 - Extended Address`,
    T2.company_name AS `Organization 1 - Name`,
    'Delivery Title' AS `Custom Field 1 - Type`,
    T2.title_d AS `Custom Field 1 - Value`,
    'Delivery First Name' AS `Custom Field 2 - Type`,
    T2.first_name_d AS `Custom Field 2 - Value`,
    'Delivery Surname' AS `Custom Field 3 - Type`,
    T2.last_name_d AS `Custom Field 3 - Value`,
    'Delivery Company' AS `Custom Field 4 - Type`,
    T2.company_name_d AS `Custom Field 4 - Value`,
    'Delivery Address Line 1' AS `Custom Field 5 - Type`,
    T2.line1_d AS `Custom Field 5 - Value`,
    'Delivery Address Line 2' AS `Custom Field 6 - Type`,
    T2.line2_d AS `Custom Field 6 - Value`,
    'Delivery Address Town' AS `Custom Field 7 - Type`,
    T2.town_d AS `Custom Field 7 - Value`,
    'Delivery Address County' AS `Custom Field 8 - Type`,
    T2.state_d AS `Custom Field 8 - Value`,
    'Delivery Address Postcode' AS `Custom Field 9 - Type`,
    T2.postcode_d AS `Custom Field 9 - Value`,
    'Delivery Address Country' AS `Custom Field 10 - Type`,
    T2.country_d AS `Custom Field 10 - Value`,
    'Delivery Phone' AS `Custom Field 11 - Type`,
    T2.phone AS `Custom Field 11 - Value`,
    'Delivery Mobile' AS `Custom Field 12 - Type`,
    T2.mobile AS `Custom Field 12 - Value`,
    'Delivery email' AS `Custom Field 13 - Type`,
    T2.email AS `Custom Field 13 - Value`
FROM
    `CubeCart_customer` T1
INNER JOIN CubeCart_order_summary T2 ON
    T1.customer_id = T2.customer_id
WHERE
    T1.customer_id > 001

Enjoy!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...