Questions tagged [xlwings]

Xlwings is a module to allow Excel to be automated with Python instead of VBA.

Xlwings. Replace your VBA code with Python, a powerful yet easy-to-use programming language that is highly suited for numerical analysis. Supports Windows and Mac

1071 questions
36
votes
1 answer

Differences between xlwings vs openpyxl Reading Excel Workbooks

I've mostly only used xlwings to open (read-write) workbooks (since the workbooks I read have complicated macros). But I've recently begun using openpyxl to open (read-only) workbooks when I've needed to read thousands of workbooks to scrape some…
Jon
  • 2,373
  • 1
  • 26
  • 34
29
votes
5 answers

Open a Workbook with XLWINGS without making it visible

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…
zeycus
  • 860
  • 1
  • 8
  • 20
24
votes
5 answers

Read data in Excel column into Python list

I am using python xlwings to read a column of data in Excel 2013. Column A is populated with numbers. To import this column into a python list py_list, I have the following code; import xlwings as xw wb = xw.Book('BookName.xlsm') sht =…
user3848207
  • 3,737
  • 17
  • 59
  • 104
23
votes
5 answers

Copying a worksheet with xlwings and python

I have been using xlwings in Python, but have not been able to figure out how to copy a worksheet. I want to treat a particular worksheet as a template, and copy that worksheet each time before making modifications. I am using version 0.11.4 of…
P. Nokes
  • 231
  • 1
  • 2
  • 7
16
votes
12 answers

xlwings function to find the last row with data

I am trying to find the last row in a column with data. to replace the vba function: LastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row I am trying this, but this pulls in all rows in Excel. How can I just get the last row. from xlwings import…
user2242044
  • 8,803
  • 25
  • 97
  • 164
14
votes
4 answers

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352565), None)

I was created example from http://docs.xlwings.org/en/stable/vba.html /Python 3.5.1 |Anaconda 2.5.0 (32-bit)| (default, Jan 29 2016, 15:46:01)/ and got error -- --------------------------- Error --------------------------- Traceback (most recent…
Evgeniy Rasyuk
  • 287
  • 1
  • 2
  • 12
12
votes
5 answers

I cannot close Excel 2016 after executing a xlwings function

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?
user2910705
  • 151
  • 1
  • 1
  • 7
11
votes
5 answers

How do I call an Excel macro from Python using xlwings?

I've read the API docs for xlwings, and played around with Workbook and Sheet objects in the interpreter, but I can't figure out how to call a macro from Python. How do I use xlwings to call an Excel macro from Python?
ABM
  • 1,628
  • 2
  • 26
  • 42
11
votes
1 answer

How do I save a workbook using xlwings?

I have an excel worksheet, some buttons and some macros. I use xlwings to make it work. Is there a way to save the workbook through xlwings ? I want to extract a specific sheet after doing an operation, but the saved sheet is the extracted sheet…
IordanouGiannis
  • 4,149
  • 16
  • 65
  • 99
9
votes
5 answers

A whole sheet into a pandas dataframe with xlwings

Thanks to pandas, we could read a whole sheet into a data frame with the "read_excel" function. I would like to use the same method using xlwings. In fact, my Workbook is already open and I don't want to use read_excel function (witch will take too…
Coolpix
  • 503
  • 1
  • 6
  • 20
8
votes
1 answer

xlwings : Object Required

I'm a newbie into both python and xlwings. So the story is, I need a custom function needs to be used in Excel. Since I have no clue about VB scripts, I decided to write a function in python and import it in excel using xlwings. I installed…
Vivek
  • 81
  • 1
  • 3
8
votes
2 answers

python xlwings - copy and paste ranges

My first question on this site. I am using xlwings with python 2.7. I want to copy the values in range 'A1:A6' from Sheet1 to cells 'A1:A6' in Sheet2. My code is as follows: > my_range = Range('Sheet1','A1:A6').value > >…
CodeNoob
  • 85
  • 1
  • 1
  • 6
8
votes
1 answer

Does xlwings require an excel install

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.
Dickster
  • 2,969
  • 3
  • 23
  • 29
8
votes
1 answer

Is there a way to call python with xlwings without reopening the Excel file?

I am calling python from Excel using xlwings. I find that when running my macro, Excel closes and reopens in order to run the code. It functions correctly but it slows things down. In addition, if the Excel file is unsaved a dialog will mention that…
KieranPC
  • 8,525
  • 7
  • 22
  • 25
8
votes
2 answers

Any way to create a new worksheet using xlwings?

Using Python xlwings, how can I create a new worksheet?
hd810
  • 197
  • 1
  • 2
  • 8
1
2 3
71 72