当前位置:首页 > PHP > 正文内容

php spreadsheet 复制工作表

高老师4年前 (2022-11-28)PHP919
       $file = 'C:/Users/gao/Documents/WXWork/1688857048324134/Cache/File/2022-08/集团报数数据差异明细对比.xlsx';
        $spreadsheet = IOFactory::load($file);
        $cloneSpreadsheet = clone $spreadsheet->getSheet(0);
        $cloneSpreadsheet->setTitle('新的工作表');
        $spreadsheet->addSheet($cloneSpreadsheet);
        $writer = new Xlsx($spreadsheet);
        $writer->save($file);


扫描二维码推送至手机访问。

版权声明:本文由高久峰个人博客发布,如需转载请注明出处。

本文链接:https://blog.20230611.cn/post/223.html

分享给朋友:

“php spreadsheet 复制工作表” 的相关文章

php异步执行,php后台运行,如何在windows下让php后台运行

php异步执行,php后台运行,如何在windows下让php后台运行

如果想在windows中执行php,并且让php脚本在后台运行,可以用下面的cmd命令start /b php  D:\wwwroot\default\demo1\run.php例如上面的命令意思后台运行run.php,如果想用php编写异步代码: ...

pcntl_signal(): Error assigning signal

pcntl_signal(): Error assigning signal

当我想在一个进程中监听kill 和 kill -9命令报了这个错误。//监听kill pcntl_signal(SIGTERM, function () {     posix_kill(0, SIGTERM); });...

php生成器的send方法详解,php yield send

php生成器的send方法详解,php yield send

【一】.基本用法首先看看官方对send方法的解释:Sets the return value of the yield expression and resumes the generato...

php event异常处理,php set_exception_handler无效

php event异常处理,php set_exception_handler无效

(1).今天遇到一件奇怪的事情,在event事件中是无法自定义异常处理,例如我们使用set_exception_handler来统一处理异常。例如下面的代码:<?php error_reporting(E_ALL); set_error_handler(function ($errn...

thinkphp5整合workerman,tp5整合workerman

thinkphp5整合workerman,tp5整合workerman

由于workerman底层直接读取$_SERVER['argv']的命令行参数,没有提供独立的方法start/stop,而tp的命令行参数无法适配workerman,虽然thinkphp官方专门做了一个适配的版本,但是看了下评论问题挺多的。于是自己来搞一个.(1).在applicat...

 php转换文本编码,php字符编码转换,php编码转换

php转换文本编码,php字符编码转换,php编码转换

整理一个自己用的编码转换方法,不需要知道原字符串的编码,只需要传入字符串,和你想要转换的编码。/**  * 编码转换  * @param string $char  * @param string $...