XLSX

Read Xlsx file in PhpSpreadsheet

故事扮演 提交于 2019-12-06 06:35:11
问题 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

How can I pass local Excel file data to Javascript array (for google charts)?

做~自己de王妃 提交于 2019-12-06 03:33:39
问题 I have a simple problem but I can't find a simple solution: I have an Excel file (always the same), with several WorkSheets that non-IT coworkers want to be able to update so that it also updates the Google Charts (or other chart API you can advise me) webpage. (By the way, I only need a certain part of each worksheet so if you know a way to extract only what I need that would be great :) ) I would like to avoid having server-side operation but it's maybe not possible since I want to read a

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

眉间皱痕 提交于 2019-12-06 03:13:34
问题 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? 回答1: xlrd has support for .xlsx files, and

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

拜拜、爱过 提交于 2019-12-06 02:28:03
问题 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 =

SheetJS xlsx-style need cell style in excel

落花浮王杯 提交于 2019-12-06 02:26:11
问题 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>

Reading .xlsx file using apache poi gives org.apache.poi.POIXMLException on linux machine

我是研究僧i 提交于 2019-12-06 02:08:26
I have an application which reads an .xlsx file and displays the content to the user. The application works fine on a windows environment. I deployed the .war file of this web app on tomcat6 on a ubuntu server. I also copied the .xlsx files on the server. The path of the files in the code is correct. But the line FileInputStream file = new FileInputStream(new File(FileName)); XSSFWorkbook workbook = new XSSFWorkbook(file); gives an error java.lang.reflect.InvocationTargetException org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException org.apache.poi.xssf.usermodel

Error loading xlsx package

烈酒焚心 提交于 2019-12-06 01:15:38
yesterday we migrated to windows 7 in our firm and also updated the java packages and also R (to 2.14). Then I tried to load the xlsx package, because I rely heavly on it but i get the following error: Error : .onAttach in attachNamespace() Error: .jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook") I tried the following, but it did not work: Sys.setenv(PATH=paste(Sys.getenv("PATH"),"C:\\Program Files (x86)\\Java\\jre6\\bin\\client",collapse=';')) options(java.parameters = "-Xmx1000m") Since I never work with java i have no clue what I can do. Can you help me? Thank you! sessionInfo() R version

ImportError: Install xlrd >= 0.9.0 for Excel support when using pd.readexcel to read .xlsx file : never happened before

China☆狼群 提交于 2019-12-06 00:28:19
Something strange is going on. Just today when trying to read in a dataframe from an xlsx file: import pandas as pd df = pd.read_excel('vlnew.xlsx',sheet_name='Sheet1') I am getting the following error: ImportError: Install xlrd >= 0.9.0 for Excel support I am fully aware that plain and simple the instructions are to install xlrd, but I should not have to install xlrd when I was never getting this error before, and also, xlrd only applies to the old .xls file format. I am using .xlsx. I can't understand why today all of a sudden this error is popping up. This is very strange indeed, at least

JAVA数据库建表工具类

跟風遠走 提交于 2019-12-05 20:45:40
前言: 在实际项目中会遇到建主题数据库的工作(主题数据库定义:面向特定的学科和应用领域,由若干的逻辑相关的数据源按照统一的标准规范整合形成,具有系统性和完整性,并通过统一的系统提供一站式服务的数据库。),就是批量按照需求建表,此时就需要一些代码辅助操作。 思路: 1、相关人员会提供表结构文件,类似如下图: 2、提取有用信息,单独建立excle文件,如下图: 3、使用代码把信息读取出来, 4、生成SQL语句, 具体实现: 1、准备java代码需要依赖的jar包: <!-- https://mvnrepository.com/artifact/org.apache.poi/poi --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.1.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.1.0</version> </dependency>

Write dataframe to excel with a title

天涯浪子 提交于 2019-12-05 18:17:58
I would like to print out a dataframe in Excel. I am using ExcelWriter as follows: writer = pd.ExcelWriter('test.xlsx') df = DataFrame(C,ind) # C is the matrix and ind is the list of corresponding indices df.to_excel(writer, startcol = 0, startrow = 5) writer.save() This produces what I need but in addition I would like to add a title with some text (explanations) for the data on top of the table ( startcol=0 , startrow=0 ). How can I add a string title using ExcelWriter? You should be able to write text in a cell with the write_string method, adding some reference to XlsxWriter to your code: