+ Start a Discussion
Abhishek Pal 33Abhishek Pal 33 

How to read and write in excel in salesforce?

I have a uploaded one excel file in folder called(New Data) in documents in salesforce. Now I want to read the contents of that excel file using apex code so that I can perform some logic and insert the data in salesforce standard object(user).

Anyone please help me in this.

Code: Document test=[select body from document where developerName='test'];
System.debug('Values :'+test);

String s= EncodingUtil.base64Encode(test.body);
System.debug('Blob value :'+s);

Result:12:29:29:009 USER_DEBUG [5]|DEBUG|Blob value :UEsDBBQABgAIAAAAIQBi7p1oXgEAAJAEAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACslMtOwzAQRfdI/EPkLUrcskAINe2CxxIqUT7A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3BzL2FwcC54bWxQSwECLQAUAAYACAAAACEAkRpz80UBAABtAgAAEQAAAAAAAAAAAAAAAAC0HAAAZG9jUHJvcHMvY29yZS54bWxQSwUGAAAAAAsACwDRAgAAMB8AAAAA


Couldnt understand how to decode this? 
Also I want to write in excel once user is created in salesforce.
(Say Flag=true)

Thanks in advance.
VineetKumarVineetKumar
Can you try something like this?
String hex = EncodingUtil.convertToHex(test[0].body);
final Integer bytesCount = hex.length() >> 1;
String[] bytes = new String[bytesCount];
for(Integer i = 0; i < bytesCount; ++i)
	bytes[i] =  hex.mid(i << 1, 2);
String output = EncodingUtil.urlDecode('%' + String.join(bytes, '%'), 'ISO-8859-1');

Excerpt from :
http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html
Abhishek Pal 33Abhishek Pal 33
It is not working. Still I am not able to ge the required value. You are trying to convert it in HEX format and then decoding the url. But the point here is I am already getting the value of body in string its just it is not in the required format that I wanted.

If I am using the csv there is no problem as such except two things:
1) I am not able to get rid of leading zero issue(Eg: 01234-----> 1234) in csv.
2) I am not able to write in csv once record is successfully inserted.