xls

Saving a .xls file with fwrite

家住魔仙堡 提交于 2019-12-03 18:00:44
问题 I have to create a script that takes a mySQL table, and exports it into .XLS format, and then saves that file into a specified folder on the web host. I got it working, but now I can't seem to get it to automatically save the file to the location without prompting the user. It needs to run every day at a specified time, so it can save the previous days leads into a .XLS file on the web host. Here is the code: <?php // DB TABLE Exporter // // How to use: // // Place this file in a safe place,

Reading numeric Excel data as text using xlrd in Python

孤人 提交于 2019-12-03 15:33:09
问题 I am trying to read in an Excel file using xlrd, and I am wondering if there is a way to ignore the cell formatting used in Excel file, and just import all data as text? Here is the code I am using for far: import xlrd xls_file = 'xltest.xls' xls_workbook = xlrd.open_workbook(xls_file) xls_sheet = xls_workbook.sheet_by_index(0) raw_data = [['']*xls_sheet.ncols for _ in range(xls_sheet.nrows)] raw_str = '' feild_delim = ',' text_delim = '"' for rnum in range(xls_sheet.nrows): for cnum in range

NPOI DataFormat

不想你离开。 提交于 2019-12-03 14:24:58
I'm exporting a grid with NPOI v1.2.3, and am having trouble getting cell formatting to work. I have a class that exports a list of objects to an XLS file. A row is created for each object, and a cell is added for each configured property. The cell data format can be set on a per-property level. I've read that you shouldn't create a new style for each cell . I can't hard-code my styles, since my exporter needs to support any class. Instead, I wrote a little cache system that only creates a new CellStyle if one hasn't already been created for the current cell's format. Unfortunately, this still

How to create a new worksheet in Excel file c#?

限于喜欢 提交于 2019-12-03 12:48:39
I need to create a very big Excel file, but excel file in one worksheet can contain up to 65k rows. So, i want to divide all my info into several worksheets dynamical. This is my approximate code //------------------Create Excel App-------------------- Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new Excel.Application(); xlWorkBook = xlApp.Workbooks.Add(misValue); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(numberOfLetters); foreach (string letter in letters) { xlWorkSheet.Cells

python xlrd unsupported format, or corrupt file.

匿名 (未验证) 提交于 2019-12-03 09:05:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My code: import xlrd wb = xlrd.open_workbook("Z:\\Data\\Locates\\3.8 locates.xls") sh = wb.sheet_by_index(0) print sh.cell(0,0).value The error: Traceback (most recent call last): File "Z:\Wilson\tradedStockStatus.py", line 18, in wb = xlrd.open_workbook("Z:\\Data\\Locates\\3.8 locates.xls") File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 429, in open_workbook biff_version = bk.getbof(XL_WORKBOOK_GLOBALS) File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 1545, in getbof bof_error('Expected BOF record; found %r' % self

Which library should I use to write an XLS from Linux / Python?

て烟熏妆下的殇ゞ 提交于 2019-12-03 07:15:20
I'd love a good native Python library to write XLS, but it doesn't seem to exist. Happily, Jython does. So I'm trying to decide between jexcelapi and Apache HSSF: http://www.andykhan.com/jexcelapi/tutorial.html#writing http://poi.apache.org/hssf/quick-guide.html (I can't use COM automation because I'm not on Windows, and even if I was, I couldn't afford Office licenses.) My initial thoughts are that POI/HSSF is very thorough, but also very Java-- everything seems a bit harder than it needs to be. Good documentation, but my head hurts trying to bridge the gap between what it describes and what

Import excel data into models via django admin

安稳与你 提交于 2019-12-03 03:08:23
I need the Django Admin interface to accept administrator uploads of Excel files where the data in each Excel file is inserted into my database models. How can I make such an “Upload” button appear on a Django model admin page, where clicking the button asks the administrator to choose an .xls file, whose data then gets added to database once its upload is complete? I'm not sure about the Django side of things, but you can use xlrd to read and manipulate Excel files. There is a free PDF which explains this called Working with Excel files in Python I have done this, but I just set up a simple

.xlsx and xls(Latest Versions) to pdf using python

匿名 (未验证) 提交于 2019-12-03 02:15:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: With the help of this .doc to pdf using python Link I am trying for excel (.xlsx and xls formats) Following is modified Code for Excel: import os from win32com import client folder = "C:\\Oprance\\Excel\\XlsxWriter-0.5.1" file_type = 'xlsx' out_folder = folder + "\\PDF_excel" os.chdir(folder) if not os.path.exists(out_folder): print 'Creating output folder...' os.makedirs(out_folder) print out_folder, 'created.' else: print out_folder, 'already exists.\n' for files in os.listdir("."): if files.endswith(".xlsx"): print files print '\n\n' word

How can I quickly and easily convert spreadsheet data to JSON? [closed]

谁说胖子不能爱 提交于 2019-12-03 01:02:54
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . I want to convert spreadsheet data (such as from Excel/*.xls files or Open Office, etc.) to JSON files. What is the easiest way to accomplish this? 回答1: Assuming you really mean "easiest" and are not necessarily looking for a way to do this programmatically, you can do this: 0)

导入csv文件xls|xlsx文件的区别

匿名 (未验证) 提交于 2019-12-03 00:26:01
导入后缀为xls或xlsx与后缀为csv文件的区别(仿sql) 一、xls xlsx文件导入 string filePath="文件路径(具体到文件名)"; string connStr="Provider=Microsoft.Jet.OleDb.4.0;" + "data source=" + filePath+ ";Extended Properties='Excel 8.0; HDR=YES; IMEX=1'""; if(文件后缀名为xlsx) { string connStr="Provider=Microsoft.Jet.OleDb.12.0;" + "data source=" + filePath+ ";Extended Properties='Excel 12.0; HDR=YES; IMEX=1'""; } OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [工作簿名称]",connStr); DataSet myDataSet = new DataSet(); myCommand.Fill(myDataSet, "表名自定义"); 二、csv后缀的文件 string path="文件的目录名即可"; string fileName="文件名"; string connStr = @