Answer the question
In order to leave comments, you need to log in
How can I implement the transfer of data from the site to google spreadsheets?
There is a site with design courses. For dynamic remarketing, you need to constantly update the data (open course or closed). To do this, you need to pass this parameter from the site to the tables. A similar example of transferring data from a site to Google Spreadsheets will be interesting.
Answer the question
In order to leave comments, you need to log in
1)Create a google spreadsheet,
2)Script editor tools
function doGet(e)
{
// 1yLhgYQ3BrAC40gt4EjM9Ye4NZn03i4dNLDNuqZNxFw4 - id вашей таблицы (можно и по другому)
var sheet = SpreadsheetApp.openById("1yLhgYQ3BrAC40gt4EjM9Ye4NZn03i4dNLDNuqZNxFw4");
var n=sheet.getRange("A1").getValue()+2;
sheet.getRange("A"+n).setValue(e.parameter.p1); // первый параметр
sheet.getRange("B"+n).setValue(e.parameter.p2);
sheet.getRange("C"+n).setValue(e.parameter.p3);
sheet.getRange("D"+n).setValue(e.parameter.p4);
sheet.getRange("E"+n).setValue(e.parameter.p5);
sheet.getRange("F"+n).setValue(e.parameter.p6); // последний
sheet.getRange("A1").setValue(n-1);
}
$ch = curl_init();
$url = 'https://script.google.com/macros/s/..QXmd4uzygY/exec?';
$url .= http_build_query(['p1' => $category, 'p2' => $section, 'p3' => $images, 'p4' => $name, 'p5' => $inf1, 'p6' => $inf2]);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
if (curl_exec($ch)) {
echo 'good<br/>';
curl_close($ch); // закрываем сеанс
}
return true;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question