I wrote a script a while back that would send data from my google spreadsheet to a website I wrote in PHP that would insert the data into a PDF and then email the PDF to the required recipients. It stopped working within the last 6 months or so, and when I looked into it, it turns out that the problem is in this section of code that sends the data :
var ss = SpreadsheetApp.getActiveSpreadsheet();
var range = ss.getRangeByName("FormFill_PDFData").getValues();
var formData = {'x': range};
var strFormData = JSON.stringify(formData);
var options = {
'method' : 'post',
'payload' : "x=" + strFormData
};
var url = "http://www.myWebSite.com/myPHP.php";
var returnValue = UrlFetchApp.fetch(url, options);
When I Logger.log the range, formData, or strFormData they all give the expected value. When I Logger.log the returnValue the sent data appears truncated.
On the PHP side, in order to debug I just receive the data and var_dump it so that the return value will be the data just received from google sheets. That PHP code looks like:
<?php
$x="";
$obj=$_POST["x"];
var_dump($obj);
?>
In order to check that the problem wasn't due to the PHP website sending the data back to google sheets incorrectly, I next tried saving the received data to a local file. That PHP code for that looks like this:
<?php
$x="";
$obj=$_POST["x"];
$fp = fopen('data.txt', 'w');
fwrite($fp, $obj);
fclose($fp);
var_dump($obj);
?>
The data.txt file on the website server also shows that the received data is truncated.
So the truncation problem seems to be happening either with the way the google sheet sends the data or with the way my webhosting server receives the data. The host is GoDaddy, so I expect that they design their sites to be able to receive large JSON files. Did Google recently put restrictions on the size of data that can be sent?
Any help would be greatly appreciated since work in this division had ground nearly to a halt due to continuing errors created now that the forms are once again being manually filled out.