xlwings

Does xlwings require an excel install

橙三吉。 提交于 2019-12-05 12:09:41
Does xlwings require an install of excel? We are hoping to use it, with an anaconda install, on a windows server, with no EXCEL, to inject some data to a workbook and pass the workbook back to the user. xlwings is indeed made for interacting with a running instance of Excel and therefore does not run on Linux. You will want to have a look into the pandas to_excel method or you may even want to use one of the underlying libraries directly that this method uses ( XlsxWriter , openpyxl and xlwt ). In short, with pandas you can do: df.to_excel('output.xlsx', 'Sheet1') 来源: https://stackoverflow.com

how to get formula result in excel using xlwings

ⅰ亾dé卋堺 提交于 2019-12-04 18:17:07
What i want to do is 1)get a folmula result in excel and 2)update the values to the existing excel file. [ I created and wrote the folmula using "xlsxwriter". But when I tried openpyxl (or pandas) to retrieve the folmula result, it returns 0. I want to use "xlwings" to solve this problem, but no idea how to do it. can anyone help? #openpyx wb = openpyxl.load_workbook(filename=xlsx_name,data_only=True) ws = wb.get_sheet_by_name("sheet1") print "venn_value",(ws.cell('X2').value) #pandas fold_merge_data=pd.read_excel(xlsx_name,sheetname=1) print fold_merge_data['Venn diagram'][:10] Yes, xlwings

【Python】处理Excel的库Xlwings

你说的曾经没有我的故事 提交于 2019-12-04 11:18:08
# # 引入库 import xlwings as xw import time # 打开Excel程序,默认设置:程序可见,只打开不新建工作薄 # app = xw.App(visible=True,add_book=False) #新建工作簿 (如果不接下一条代码的话,Excel只会一闪而过,卖个萌就走了) # wb = app.books.add() # 打开已有工作簿(支持绝对路径和相对路径) # wb = app.books.open('example.xlsx') 练习的时候建议直接用下面这条,这样的话就不会频繁打开新的Excel wb = xw.Book('example.xlsx') print('-----新建sheet-----') wb.sheets.add('jenny') # 引用Excel工作表,单元格 print('-----引用-----') # 引用工作表 sht = wb.sheets[0] #sht = wb.sheets[第一个sheet名] # 引用单元格 rng = sht.range('a1') # #rng = sht['a1'] # #rng = sht[0,0] 第一行的第一列即a1,相当于pandas的切片 print ("引用单元格: "+str(rng.value)) # # # 引用区域 rng = sht.range(

I cannot close Excel 2016 after executing a xlwings function

点点圈 提交于 2019-12-04 08:40:19
问题 when I execute a an Xlwings function I can save and close the workbook. But I cannot close Excel 2016 anymore. Is this a known issue? How can I fix this? 回答1: Here is how I got it to work: import xlwings as xw wbPath = [WorkbookPath] wb = xw.Book(wbPath) app = xw.apps.active wb.save(wbPath) #wb.close() app.quit() Note that I commented out the line wb.close() . You can skip this step and instead set the app = active Excel instance, save the workbook, and then quit the app. 来源: https:/

How to reference Excel table column names in XLWings?

孤人 提交于 2019-12-04 05:24:46
问题 Does XLWings allow my to interact with Excel tables (available in Excel 2007 and later via menu or ctrl+t) by table and column names? This does exist in the young, open sourceproject, Pyvot (https://pypi.python.org/pypi/Pyvot). I am hopeful that it is possible in XLWings now or that XLWings will add the functionality, Especially since this open source project is available as a model. Here is an example from https://pythonhosted.org/Pyvot/tutorial.html. "Pyvot specifically recognizes column

importing xlwings module into python 3.4

房东的猫 提交于 2019-12-04 03:51:49
问题 I'm trying to use the new excel integration module xlwings It works like a charm under Anaconda 2.0 for python 2.7 but I'm getting this error under Anaconda 2.0 for python 3.4 the xlwings file does contain class Workbook so I don't understand why it can't import it when I simply use the xlwings file in my project for 3.4 it works just fine File "C:\Users\xxxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\xlwings__init__.py", line 1, in from xlwings import Workbook, Range, Chart,

Replicating YEARFRAC() function from Excel in Python

感情迁移 提交于 2019-12-03 15:40:08
So I am using python in order to automate some repetitive tasks I must do in excel. One of the calculations I need to do requires the use of yearfrac(). Has this been replicated in python? I found this but it is incorrect for the value I tried. (From 12/19/2011 to 3/31/17, yearfrac() gives 5.2833333333333300000, but the python function in the link gives 5.2807978099335156.) I found an e-mail thread from actual Office developers providing a VBA implementation of the YEARFRAC algorithm. Public Function FIsLeapYear(Year As Integer) As Boolean If (Year Mod 4) > 0 Then FIsLeapYear = False ElseIf

Open a Workbook with XLWINGS without making it visible

邮差的信 提交于 2019-12-03 06:57:44
问题 I am starting to use XLWings (not that I like Excel, at all, but it is something I HAVE TO do). The thing is that I cannot find the way to make Python open a Workbook without showing it. It seems the constructor for Workbooks in the old XLWings 0.6.4 was xlwings.Workbook, and one of the arguments was a flag 'app_visible' (see http://docs.xlwings.org/en/v0.6.4/api.html). However, in the new v0.9.2 Workbook has been replaced by Book, and Book does not have any such flag (http://docs.xlwings.org

I cannot close Excel 2016 after executing a xlwings function

有些话、适合烂在心里 提交于 2019-12-03 03:23:40
when I execute a an Xlwings function I can save and close the workbook. But I cannot close Excel 2016 anymore. Is this a known issue? How can I fix this? Here is how I got it to work: import xlwings as xw wbPath = [WorkbookPath] wb = xw.Book(wbPath) app = xw.apps.active wb.save(wbPath) #wb.close() app.quit() Note that I commented out the line wb.close() . You can skip this step and instead set the app = active Excel instance, save the workbook, and then quit the app. 来源: https://stackoverflow.com/questions/41089223/i-cannot-close-excel-2016-after-executing-a-xlwings-function

xlwings with python 3.5 on Windows

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been stuck for some time. My configuration is: python 3.5 , xlwings 0.5.0 and Windows 7 . I get the following traceback while trying to import xlwings : Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Program Files\Python 3.5\lib\site-packages\xlwings\__init__.py", line 20, in <module> from . import _xlwindows as xlplatform File "C:\Program Files\Python 3.5\lib\site-packages\xlwings\_xlwindows.py", line 15, in <module> import pywintypes File "C:\Program Files\Python 3.5\lib\site-packages\win32\lib