简体   繁体   中英

Open an excel using php and command line/command prompt/ powershell

I want to open an excel and then manipulate the content using php and command line/cmd or powershell.

I have this script already

$data = file("input.csv");
foreach ($data as $line) {
    $lineArray = explode(",", $line);
    list($XXX, $XXX, $XXX, $XXX, $XXX, $XXX) = $lineArray;

    echo $XXX.",".$XXX.",".$XXX.",".$XXX.",".$XXX.",".$XXX;
    echo "\n";
}

I'm just running it in power shell using this

php test.php 

What I'm targeting to do is like this

php test.php input.csv

and I will remove the statically coded input.csv

Got it.

I did this

php test.php input.csv

and used the input as an argument

$args = $argv[1];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM