humanemulator.net — справка. Продукт, демо и покупка — на хуманэмулятор.рф | Демо | Купить | API | Changelog

get_col

get_col($path,$sheet,$col); - Получить столбец Листа файла Excel как массив

Функция на вход принимает параметры:

  • $path – Путь к файлу Excel
  • $sheet – Номер Листа
  • $col – Номер колони

    После выполнения функции возвращаемое значение будет равно одному из двух :
  • результат – массив строк
  • пусто / null – ошибка

    Пример использования
    <?php
    
    // Scenario: Get column data from Excel file
    
    $xhe_host = getenv("RPABOT_HOST_URL");
    
    // Connect functional objects if not already connected
    if (!isset($path)){
        // Path to the init.php file for connecting to the XHE API
        $path = "../../../Templates/init.php";
        // Including init.php grants access to all classes and functionality for working with the XHE API
        require($path);
    }
    
    echo "\n<span >excelfile->" . basename(__FILE__) . "</span>\n";
    
    // Initialize Excel
    SYSTEM::$excel->kill();
    
    // Example 1: Get a specific column as an array
    echo("Example 1: Get a specific column as an array : ");
    // Extract method arguments into variables
    $filePath = "test/test.xlsx";
    $sheetIndex = 0;
    $columnLetter = "D";
    var_export(SYSTEM::$excelfile->get_col($filePath, $sheetIndex, $columnLetter));
    
    // View result
    
    
    // End of script
    echo "\n";
    
    // Quit application
    WINDOW::$app->quit();
    ?>

    =============================================
    excelfile    Объекты    DOM  System  Vision  Web  Window        
    =============================================
    если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
    .