I'm struggling to find out the best solution to the following scenario: I have a big static csv file containing data not related to salesforce. I would like to get a specific value on my csv file and save it on a specific field on the account. How can I create the connection between my org and my local csv file? I tried to upload the csv file on Documents in my org but it's too big. I think dataloader is not my solution because it needs an external id to update the account but in my csv file I have data not related to salesforce.

Thanks in advance

  • How are you connecting the rows in your CSV to your Salesforce accounts? What data point do they have in common? – David Reed Oct 3 '18 at 13:48
  • Hi David, thank you for reply. I have a custom field on the account as external id, when this field is equal to a value of the column used as external id in the csv file, I have to get the values of the row. – Antonino Cupi Oct 3 '18 at 13:53

You can use the Data Loader to upsert your accounts, matching them on your External Id column. Make sure to select the Upsert operation, and tell Data Loader you want to match using that field.

Data Loader will provide you with an opportunity to map columns between your CSV file and your Salesforce object. When you do so, you'll map only those fields that you want to update. It doesn't matter if there is a lot of unrelated data in your CSV - simply don't map those fields. Only the fields you map will be updated in Salesforce by Data Loader.

It sounds like you need to map only your External Id and a single other field. That's fine. If it increases your comfort level, simply create a copy of your CSV and delete all of the other columns before beginning your load process.

If the value you are working with is not, in fact, an External Id and you cannot make it such for some reason, your next step is likely to use a tool like LibreOffice or Microsoft Excel to perform an INDEX()/MATCH() or VLOOKUP() pass to map from your shared data point to a Salesforce Id or External Id column on the Account. You would then use that value to perform your update or upsert operation.

In that situation, you'll need to take care to handle case correctly - if your non-external-Id is not case-safe, be aware that these Excel functions treat, e.g., AAa and AAA as equivalent. You can get around this using array functions, but it can be excruciatingly slow. You'll also have to account for any duplicate values appropriately.

| improve this answer | |
  • Thanks for your support, but I'm sorry I made a mistake, because the field on the account (that I use to filter the csv row) is not an external id. – Antonino Cupi Oct 3 '18 at 14:45
  • Can you make it an External Id? Is it unique? – David Reed Oct 3 '18 at 15:06
  • Unfortunately not – Antonino Cupi Oct 3 '18 at 15:08
  • I've added some notes. If you cannot use an external Id, you'll have to do a much more manual process. – David Reed Oct 3 '18 at 15:36
  • Thanks again David, but I would like to make it as automatical process writing Apex code if necessary, because it would be a static csv file, so I shouldn't handle it. My problem is just how I should start in order to read the csv, because I can't upload the file on Salesforce (too big). – Antonino Cupi Oct 4 '18 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.