function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
piyushd1.392619227021639E12piyushd1.392619227021639E12 

Excel to SFDC integration urgent

Hi,
Requirement
Upon opening the excel, user should be ask for credentials in pop up possibly using which connects to Salesforce, pull data and populate the existing Excel Template. There should be button on the excel which upon click should update Salesforce with the data in excel fields.

We are using REST API. From Excel macro we are able to pull data from SFDC and populate in Excel
We are trying to update excel data back to Salesforce. We want to call UpdateRequest method from Excel VBA script. Can anyone provide any sample code for calling UpdateRequest method.

''
' Setup generic update request
' --------------------------------------- '
Public Function UpdateRequest(ObjectName As String, ObjectId As String, Values As Dictionary) As RestRequest
    Dim Request As RestRequest
    Set Request = ObjectRequest(ObjectName, ObjectId)
   
    ' Remove Id from values for update
    If Values.Exists("Id") Then Values.Remove "Id"
   
    ' Set method and add body
    Request.Method = httpPATCH
    Request.AddBody Values
   
    Set UpdateRequest = Request
End Function
Best Answer chosen by thisisnotapril
VikashVikash (Salesforce Developers) 
Hi Piyush,

Please follow the link below, this link will help you in understand how to integrate Salesforce to Excel.
http://www.youtube.com/watch?v=Imgl46lDas4
https://code.google.com/p/excel-connector/
https://developer.salesforce.com/page/Force.com_Excel_Connector

Thanks
Vikash_SFDC

All Answers

VikashVikash (Salesforce Developers) 
Hi Piyush,

Please follow the link below, this link will help you in understand how to integrate Salesforce to Excel.
http://www.youtube.com/watch?v=Imgl46lDas4
https://code.google.com/p/excel-connector/
https://developer.salesforce.com/page/Force.com_Excel_Connector

Thanks
Vikash_SFDC
This was selected as the best answer
piyushd1.392619227021639E12piyushd1.392619227021639E12

Hi Vikas,
If we use Excel connector it will require office toolkit intallation at individual machines. Our client doesn't want to take this approach. So we are going with REST API approach. We were able to successfully call UpdateRequest method from Excel VBA macro, but it was possible only for single record id
Set Request = UpdateRequest("Object Name","Record Id", objDict)
We want to update all records from Excel to SFDC. We are thinking of having looping and calling this method. Would like to know is this the right approach or how we can pass multiple records to this method/some other method for performing update

Thank You,
Piyush Divecha

VikashVikash (Salesforce Developers) 
Hi Piyush,

You can use Bulk API here is a link which can explain how to use the bulk api for mass transfer.https://developer.salesforce.com/page/Loading_Large_Data_Sets_with_the_Force.com_Bulk_API

Thanks
Vikash_SFDC
piyushd1.392619227021639E12piyushd1.392619227021639E12
We are using Connected App and from excel macro connecting to SFDC using User credentials

Salesforce.ConsumerKey = "3MZG9zJJ_hzz0bb9o.MA3IV8zEbQ6DeHIjf_3ypyIQYXt9r5Xp.RUeRV3bYCHkkjiaoSAu4S21GabT_lCGxEI "
Salesforce.ConsumerSecret = " 655555533826828064"
Salesforce.Username = "test@aig.com.poc"
Salesforce.Password = "test9999"
Salesforce.SecurityToken = "9b3gfExxxx4GM9GCByQVs4eWfZ"

Can anyone provide any sample code for using Bulk API from Excel macro.
VikashVikash (Salesforce Developers) 
Hi Piyush,

Please refer this link hope this helps:
https://na10.salesforce.com/chatteranswers/ChatterAnswersQuestionSingleItem.apexp?id=906F0000000A5CQ

Thanks
Vikash
Divya VeerisettyDivya Veerisetty
Hi Piyush,

We are trying to integrate Excel with Salesforce to update data into salesforce without using connectors. Our requirement doesn't need bulk operations. Can you please help us with some sample code as you already worked on similar integartion.

Thanks,
Divya