1

I'm using Zend Gdata to create worksheets in a Google Spreadsheet. Because I'm storing data in my newly-created worksheets, I progammatically set the columns' headers.

$headers = array(
    'Nom',
    'Prénom',
    'Entreprise/Organisation',
    'Fonction',
    'Adresse e-mail',
    'Téléphone',
    'Connu par'
);

foreach ($headers as $k => $col) {
    $connect->updateCell(1, $k+1, htmlspecialchars($col), $spreadsheet_id, $worksheet_id);
}

$headers = $connect->insertRow(
    array(
        htmlspecialchars('nom') => 'SKLI',
        htmlspecialchars('prénom') => 'Pierre',
        htmlspecialchars('entrepriseorganisation') => 'mosaika',
        htmlspecialchars('fonction') => 'ceo',
        htmlspecialchars('adressee-mail') => 'ble@ble.com',
        htmlspecialchars('téléphone') => '00 43 08 03 23',
        htmlspecialchars('connupar') => 'ble'
    ),
    $spreadsheet_id,
    $worksheet_id
);

So as you can see, I'm using the updateCell() method to first define my header columns, and then insertRow() to fill the columns with data. When I execute my code and look at the open spreadsheet in Google Drive, I can see that the updateCell() is iterated and the columns headers are created one after another, whereas the data rows (with insertRow()) is added instantly, row by row.

Is there another faster way to define the header columns "instantly" just like with insertRow() instead of creating them one by one ?

Thanks !

user1821591
  • 101
  • 1
  • 4

0 Answers0