• Elie Rodrigue
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies

Sometime, when we try to read or write multiple cells value in a google spreadsheet we often get timeouts. We read the cells using getFeedRange and write using updateCells. We are using large range to read and write (~75 cells at a time) which could cause this problem, but can't avoid this as we are already on our 10 callouts limits.

 

 

The request timeout is already set at 60 seconds.

 

It seems like the timeout occurs at random on any calls to google service : it happened on getSpreadsheetsTitle , getWorksheetFeedUrl, getFeedRange and updateCells...

 

Is there any to diagnose this properly? What could cause this problem?

Hi,

    we've been using the force.com google data api for some time now and a bug in the library did slowed us down in the beginning. We've been able to work around this problem but we think this should be fixed in the library.

To reproduce, create a spreadsheet document then set a value from a1 to g1.

 

Then run the included test code (dont forget to replace username, login and spreadsheet name with the proper info).

 

It will crash everytime when updating cell F1 with a null reference exception.

 

Keep in mind that this is test code only, cells update should be batched and better exception handling should be made but this is just some sample code to reproduce a problem we saw with the library!

 

  SpreadSheetService service = new SpreadsheetService();
            service.useClientLogin(username, login);
            GoogleData sheets = service.getSpreadsheets();
           
            //get spreadsheet
            GoogleData feeda = service.getSpreadsheetsTitle(spreadsheetname)

       xmldom.element ssheet = feeda.entries[0];
       
        //get worksheet in spreadsheet
        string workSheetFeedUrl = SpreadsheetService.getWorksheetFeedUrl(ssheet);
            GoogleData worksheetsFeed = service.getFeed( workSheetFeedUrl );  
        GoogleData.Worksheet worksheet = new GoogleData.Worksheet( worksheetsFeed.entries[0] );
      
       //get cell data from worksheet in spreadsheet
       string cellFeedUrl = worksheet.getCellFeedUrl();
           
            // specify range to avoid data overflow
            GoogleData feed = service.getFeedRange( cellFeedUrl ,'A1:L1'); 
           
            //get the cell values
            list<GoogleData.Cell> cells = worksheet.cellFactory( feed.entries );                 
            for (GoogleData.Cell cel : cells  )
            {
                        cel.content = '5';
                        service.updateCell(worksheet, cel);
            }
           
            //get the cell values
            feed = service.getFeedRange( cellFeedUrl ,'M1:N1'); 
            cells = worksheet.cellFactory( feed.entries );                 
            for (GoogleData.Cell cel : cells  )
            {
                 if(cel.title == 'M1')
                 {
                 System.debug('CELL M1 is: '+cel.content);
             
                 }
            }
       

Hi, i'm having a weird error when trying to set some fields to null. Here my code :
Code:
$paramsToNull =  new stdclass();

$paramsToNull->Id = '---blanked---';
$paramsToNull->fieldsToNull = array('Month_2_Volume__c');
$conn = GetSalesForceConnection();
try
{
$response = $conn->update(array($paramsToNull),'Lead');

}
catch(Exception $e)
{
 echo $conn->getLastRequest();
 
}

And I get this error : SoapFault exception: [soapenv:Client] Unexpected element {http://www.w3.org/2001/XMLSchema}string during simple type deserialization

GetLast Request give me this :
Code:
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap-env:header><ns1:sessionheader><ns1:sessionid>462400D70000000IU3D!ARAAQBoC7VBwLSMFVqdnzTQ8RvqOmelRsG5AZhI1.XaHCgIpkgrEO.X9iCOTkAcfQqmEUq5LjG6Va.4E27IrIaAi90_TvLkQ</ns1:sessionid></ns1:sessionheader></soap-env:header><soap-env:body><ns1:update><ns1:sobjects xsi:type="ns1:Lead"><id>00Q7000000L0yvAEAR</id><fieldstonull><xsd:string>Month_2_Volume__c</xsd:string></fieldstonull></ns1:sobjects></ns1:update></soap-env:body></soap-env:envelope>

If I remove the fieldsToNull value and add some other fields value, the update work fine.

 I tried to reproduce using .Net instead of PHP and it work fine, using the same wsdl file.

Please help,
Elie

 

Hi, i'm having a weird error when trying to set some fields to null. Here my code :
Code:
$paramsToNull =  new stdclass();

$paramsToNull->Id = '---blanked---';
$paramsToNull->fieldsToNull = array('Month_2_Volume__c');
$conn = GetSalesForceConnection();
try
{
$response = $conn->update(array($paramsToNull),'Lead');

}
catch(Exception $e)
{
 echo $conn->getLastRequest();
 
}

And I get this error : SoapFault exception: [soapenv:Client] Unexpected element {http://www.w3.org/2001/XMLSchema}string during simple type deserialization

GetLast Request give me this :
Code:
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap-env:header><ns1:sessionheader><ns1:sessionid>462400D70000000IU3D!ARAAQBoC7VBwLSMFVqdnzTQ8RvqOmelRsG5AZhI1.XaHCgIpkgrEO.X9iCOTkAcfQqmEUq5LjG6Va.4E27IrIaAi90_TvLkQ</ns1:sessionid></ns1:sessionheader></soap-env:header><soap-env:body><ns1:update><ns1:sobjects xsi:type="ns1:Lead"><id>00Q7000000L0yvAEAR</id><fieldstonull><xsd:string>Month_2_Volume__c</xsd:string></fieldstonull></ns1:sobjects></ns1:update></soap-env:body></soap-env:envelope>

If I remove the fieldsToNull value and add some other fields value, the update work fine.

 I tried to reproduce using .Net instead of PHP and it work fine, using the same wsdl file.

Please help,
Elie