XLSX

Read Xlsx file in PhpSpreadsheet

社会主义新天地 提交于 2019-12-04 12:50:24
I want to read an xlsx file that was created in Microsoft Excel, but when I run the following code... $Source_File = "test.xlsx"; $Spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($Source_File); ...I receive the following error: Fatal error: Uncaught PhpOffice\PhpSpreadsheet\Reader\Exception: Unable to identify a reader for this file in /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php:163 Stack trace: #0 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php(93): PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile('file:///home

Print/save Excel (.xlsx) sheet to PDF using R

↘锁芯ラ 提交于 2019-12-04 11:39:53
I want to print an Excel file to a pdf file after manipulating it. For the manipulation I used the .xlsx package which works fine. There is a function printSetup but I cannot find a function to start the printing. Is there a solution for this? library(xlsx) file <- "test.xlsx" wb <- loadWorkbook(file) sheets <- getSheets(wb) # get all sheets sheet <- sheets[[1]] # get first sheet # HERE: MAGIC TO SAVE THIS SHEET TO PDF It may be a solution using DCOM through the RDCOMClient package, though I would prefer a plattform independent solution (e.g. using xlsx ) as I work on MacOS. Any ideas? Below a

.xls convert to xlsx using java and POI APACHE

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 11:33:59
I'm trying to use POI.APACHE to edit excel files in java. I have to convert a .xls to .xlsx because I need to send the file to sharepoint. Thats why it just can't be renamed with a different extension. How would I go about this? I couldn't find any examples on their site. Thanks import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Iterator; import org.apache.poi.hssf.usermodel.HSSFWorkbook

PHPExcel: “Impossible to read file” error Converting Excel to PDF (.xlsx to .pdf)

人盡茶涼 提交于 2019-12-04 08:52:38
I have a xlsx with only one spreadsheet. I use PHPExcel to convert it to a pdf through the following code: error_reporting(E_ALL); date_default_timezone_set('Europe/London'); require_once 'phpExcel/PHPExcel/IOFactory.php'; require_once 'phpExcel/PHPExcel.php'; $inputFileName = 'doc/ModUnico'; $excel2 = PHPExcel_IOFactory::createReader('Excel2007'); $excel2 = $excel2->load($inputFileName.'.xlsx'); $excel2->setActiveSheetIndex(0); $excel2->getActiveSheet()->setCellValue('H5', '4'); $objWriter = PHPExcel_IOFactory::createWriter($excel2, 'Excel2007'); $objWriter->save($inputFileName.'_.xlsx');

csv & xlsx files import to pandas data frame: speed issue

大城市里の小女人 提交于 2019-12-04 07:53:05
Reading data (just 20000 numbers) from a xlsx file takes forever: import pandas as pd xlsxfile = pd.ExcelFile("myfile.xlsx") data = xlsxfile.parse('Sheet1', index_col = None, header = None) takes about 9 seconds. If I save the same file in csv format it takes ~25ms: import pandas as pd csvfile = "myfile.csv" data = pd.read_csv(csvfile, index_col = None, header = None) Is this an issue of openpyxl or am I missing something? Are there any alternatives? Matti John xlrd has support for .xlsx files, and this answer suggests that at least the beta version of xlrd with .xlsx support was quicker than

Laravel 5使用Laravel Excel实现Excel/CSV文件导入导出的功能详解

こ雲淡風輕ζ 提交于 2019-12-04 07:45:23
1、简介 Laravel Excel 在 Laravel 5 中集成 PHPOffice 套件中的 PHPExcel ,从而方便我们以优雅的、富有表现力的代码实现Excel/CSV文件的导入和 导出 。 该项目的GitHub地址是: https://github.com/Maatwebsite/Laravel-Excel。 2、安装&配置 使用Composer安装依赖 本文我们将在Laravel中使用Laravel Excel简单实现Excel文件的导入和导出。 首先进入Laravel项目根目录下使用Composer安装依赖: composer require maatwebsite/excel=~2.0 安装后的设置 在 config/app.php 中注册服务提供者到 providers 数组: Maatwebsite\Excel\ExcelServiceProvider::class, 同样在 config/app.php 中注册门面到 aliases 数组: 'Excel' => Maatwebsite\Excel\Facades\Excel::class, 如果想要对Laravel Excel进行更多的自定义配置,执行如下Artisan命令: php artisan vendor:publish 执行成功后会在 config 目录下生成一个配置文件 excel.php 。

SheetJS xlsx-style need cell style in excel

扶醉桌前 提交于 2019-12-04 07:36:41
I am trying to export excel using SheetJS/xlsx and want to format cell. I am using following code and excel is generating but can't format a cell. Can any one point the issue or can share a complete sample code for this? Loading library files <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <script type="text/javascript" src="http://oss.sheetjs.com/js-xlsx/xlsx.core.min.js"></script> <script type="text/javascript" src="http://sheetjs.com/demos/FileSaver.js"></script> Remaining code are function Workbook() { if(!(this instanceof Workbook)) return new Workbook(); this

微服务之间调用控制器注解类型的差异

给你一囗甜甜゛ 提交于 2019-12-04 07:30:22
今天在一个业务服务通过Feign调用文件服务上传文件时遇到了几个问题: 1. 提示http请求头过大的问题; 此时需要修改bootstrap.yml,加入 server: max-http-header-size: 10000000 用以放大尺寸 2. 调用方法时提示404,无返回结果; 解决方法:把控制器的注解由@Controller变为@RestController,就可以 被调用方具体代码如下: @Slf4j @RestController @RequestMapping("/image") public class ImageController { private static List<String> allowUploadSuffixes = new ArrayList<>(Arrays.asList("png", "jpg", "jpeg", "zip", "pdf", "xls", "xlsx", "rar", "doc", "docx")); @Autowired private UploadFileEntityMapper uploadFileEntityMapper; @RequestMapping(value = "/uploadBase64", method = RequestMethod.POST) @ApiOperation(value =

how to open xlsx file with python 3

爱⌒轻易说出口 提交于 2019-12-04 05:59:05
I have an xlsx file with 1 sheet. I am trying to open it using python 3 (xlrd lib), but I get an empty file! I use this code: file_errors_location = "C:\\Users\\atheelm\\Documents\\python excel mission\\errors1.xlsx" workbook_errors = xlrd.open_workbook(file_errors_location) and I have no errors, but when I type: workbook_errors.nsheets I get "0", even the file has some sheets... when I type: workbook_errors I get: xlrd.book.Book object at 0x2.. any help? thanks You can use Pandas pandas.read_excel just like pandas.read_csv : import pandas as pd file_errors_location = 'C:\\Users\\atheelm\

Error Message after creating XLSX file using java

泄露秘密 提交于 2019-12-04 05:11:09
问题 I am using apache poi to create a simple xlsx file using java as follows String date = "2014/12/29"; XSSFWorkbook w = ADPFidessa.createExcelWorkbook(date); response.reset(); response.setContentType("application/xlsx"); response.setHeader("Content-Disposition", "attachment;filename=ADP_Fidessa.xlsx"); w.write(response.getOutputStream()); and here is the createExcelWorkbook method public static XSSFWorkbook createExcelWorkbook(String sBsnsDt) throws Exception { // create a new file