XLSX

xlsx compressed by rubyzip not readable by Excel

北城余情 提交于 2019-11-29 23:54:05
问题 I am working on writing code which can read/write Excel xlsx files. xlsx files are simply zip archives of several xml files, so in order to test out if I could write a file, I used a gem called rubyzip to unzip the xlsx file and then immediately zip it back up to a new archive, without modifying the data. When I do this, however, I cannot open the new excel file, it is said to be corrupted. Alternatively, if I use Mac OS X's Archive Utility (the native application to handle zip files), and I

EPPlus - How to use a template

喜你入骨 提交于 2019-11-29 23:10:29
I have recently discovered EPPlus ( http://epplus.codeplex.com/ ). I have an excel .xlsx file in my project with all the styled column headers. I read on their site that you can use templates. Does anyone know how or can provide code sample of how to use my template.xlsx file with EPPlus? I would like to be able to simply load my data into the rows without messing with the headings. The solution I ended up going with: using System.IO; using System.Reflection; using OfficeOpenXml; //Create a stream of .xlsx file contained within my project using reflection Stream stream = Assembly

Pandas DataFrame创建方法大全

不羁岁月 提交于 2019-11-29 20:48:16
Pandas是Python的数据分析利器,DataFrame是Pandas进行数据分析的基本结构,可以把DataFrame视为一个二维数据表,每一行都表示一个数据记录。本文将介绍创建Pandas DataFrame的6种方法。 创建Pandas数据帧的六种方法如下: 创建空DataFrame 手工创建DataFrame 使用List创建DataFrame 使用Dict创建DataFrme 使用Excel文件创建DataFrame 使用CSV文件创建DataFrame 1、创建空的Pandas DataFrame 学编程,上 汇智网 ,在线编程环境,一对一助教指导。 首先我们看一下如何创建一个空的DataFrame(数据帧): pd.DataFrame(columns=['A', 'B', 'C'], index=[0,1,2]) columns参数用来定义列名,index参数用来定义行号。上面的代码创建了一个3行3列的二维数据表,结果看起来是这样: 嗯,所有数据项都是NaN。 2、手工创建Pandas DataFrame 接下来让我们看看如何使用 pd.DataFrame 手工创建一个Pandas数据帧: df = pd.DataFrame(data=['Apple','Banana','Cherry','Dates','Eggfruit']) 使用data参数来声明数据

How to extract plain text from a DOCX file using the new OOXML support in Apache POI 3.5?

*爱你&永不变心* 提交于 2019-11-29 17:24:33
问题 On September 28, 2009 the Apache POI project released version 3.5 which officially supports the OOXML formats introduced in Office 2007, like DOCX and XLSX. Please provide a code sample for extracting a DOCX file's content in plain text, ignoring any styles or formatting. I am asking this because I have been unable to find any Apache POI examples covering the new OOXML support. 回答1: This worked for me. Make sure you add the required jars (upgrade xmlbeans, etc.) public String extractText

Convert XSLX to CSV using VBA [duplicate]

为君一笑 提交于 2019-11-29 17:19:52
This question already has an answer here: Export sheet as UTF-8 CSV file (using Excel-VBA) 3 answers First of all, I'm quite amateur on VBA that why i need your help! I use the code below to convert .xlsx to .csv but somehow the character is not good to see.English is ok but Vietnamese character is not easy to see. For example, copy this text" Bạn đánh giá về nhà hàng của chúng tôi hôm nay như thế nào?" to xlsx file and use code below to convert to csv. Then the character is shown like this "Ba?n ?a?nh gia? vê? nha? ha?ng cu?a chu?ng to?i ho?m nay nhu? thê? na?o?" Anyone can help

How to convert xls file to xlsx file using C#?

随声附和 提交于 2019-11-29 13:47:31
I was developing an application which read data from an excel file, but when I try to open it, an exception was thrown if the source file is saved with the xls format (File contains corrupted data error when opening Excel sheet with OpenXML). indeed when I save this file with the xlsx format it works fine. please help me to solve this problem. j1rjacob Use Free Spire.XLS dll available via NuGet . Sample: Workbook workbook = new Workbook(); workbook.LoadFromFile("Input.xls"); workbook.SaveToFile("Output.xlsx", ExcelVersion.Version2013); You cannot read xls files with OpenXML. The solution from

How to read data from xlsx in perl

女生的网名这么多〃 提交于 2019-11-29 11:31:41
Need a few good people help me with reading excel file with extension "xlsx" my script works for "xls" but not "xlsx", here is the code I get error: Can't call method "worksheet" on an undefined value if the file is "xlsx" here is the code I do have: #!/usr/bin/perl -w use warnings; use strict; use Spreadsheet::ParseExcel; use Spreadsheet::XLSX; use Date::Format; my $filename = "../test.xlsx"; #Parse excel file my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse("$filename"); #Get cell value from excel sheet1 row 1 column 2 my $worksheet = $workbook->worksheet('Sheet1');

openxlsx not able to read from .xlsx file in R

有些话、适合烂在心里 提交于 2019-11-29 11:31:14
I am trying to read value from a .xlsx file using openxlsx package in R . In simple words, I need to write a row of data, which then populates some output cell that has to be read back in R. I will share an example to better explain the problem. Initial state of the .xlsx file: I'm now trying to write new values to the cell : A2:A3 = c("c", 5). So ideally, I'm expecting A6 = 15 Below is the code used : require(openxlsx) path <- "C:/path_to_file/for_SO1.xlsx" input_row <- c("c", 5) # Load workbook; create if not existing wb <- loadWorkbook(path) # createSheet(wb, name = "1") writeData(wb, sheet

Django: openpyxl saving workbook as attachment

北城余情 提交于 2019-11-29 11:07:21
问题 Hi I have a quick question. I didn't find answer in internet maybe someone of you can help me. So i want to save workbook as attachment but I don't know how lets see an example : from openpyxl import Workbook from openpyxl.cell import get_column_letter wb = Workbook(encoding='utf-8') dest_filename = 'file.xlsx' ws = wb.worksheets[0] ws.title = "range names" for col_idx in xrange(1, 40): col = get_column_letter(col_idx) for row in xrange(1, 600): ws.cell('%s%s'%(col, row)).value = '%s%s' %

CSVs to multi-sheet XLS without Excel installed. Powershell

允我心安 提交于 2019-11-29 08:43:20
I have a folder with multiple CSV files. I'd like to take all of them and make a XLS (or xlsx) with a sheet representing each CSV file. The key difference here is Excel is not installed and can't be. I understand I may be able to use the EPPlus library - http://epplus.codeplex.com/ . I've also read of using the Access Database Engine - http://www.microsoft.com/en-us/download/details.aspx?id=13255 . I've gone through a number of different scripts for converting CSV to XLS in the traditional fashion and tried converting them to use one of these but don't seem to be getting very far. Is this even