You need to sign in to do that
Don't have an account?

Upload Excel File
Hi all,
i have developed an application using sales force api recently.Now i have a problem when i am uploading the file physically to salesforce from my applicaton.can u give the solution for this.
What exactly is the problem?
jason
Please explain your problem and use case.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
I have developing application using Apex, My application generate Excel Sheet for each Opportunity.My Problem is i need to upload that Excel sheet for that opportunity in sales force using APEX.
Do you mean you want the excel file attached to each opportunity? Or stored as a Document in Salesforce?
How is the excel file generated?
Hi
Yes ,i want attached excel sheet for each opportunity from my application, i have generated excel sheet from Goggle Analytics based on opportunity.
with regards
ramesh
Well the normal way to create an attachment in apex is as follows:
where fileBody is a Blob and fileName a string.
I think it would be useful to see the apex code where you're generating the excel file.
Hi
i am trying your code still i am not able to handle "insert myAttachment;" , i need more details on that.
with regards
ramesh
This blog has an example of attaching a pdf to an object. It might make things clearer.
What are the details related to "I am still not able to handle..."? If you want us to be able to help you do what you need to, you're going to have to be more forthcoming with details of what is not working for you. What happens when you try the code you were given? Have you been using the System Log to do any debuggin?
jason
Hi
Please observe my code and give me the suggestions.
qr = binding.query("select Account.Id,Account.Name,Id,Name,Web_Services_Report_URL__c from opportunity where Web_Services_End_Date__c > TODAY and Web_Services_Start_Date__c <= TODAY and name like '%_IWeb_%' and Name='Yale University_School of Management_IWeb_2010'");
records = qr.records;
apex.Opportunity opt = (apex.Opportunity)records[0];
apex.Attachment attch = new apex.Attachment();
attch.Body = blob1;
attch.Name="D:\fileserver\5-2011\PetersonsWebServicesReport-06-20-2011-chesneyr@wpunj.edu-3.xls";
attch.ParentId=opt.Id;
insert attch; //How to handle this statement
and also i need to upload this file name(attch.Name ) to custom field "Web_Services_Report_URL__c "
with regards
Ramesh