2

I need to send keys to excel to refresh formulas.

What are my best options?

I am already using Openpyxl but it does not satisfy all my needs.

Evan Kiser
  • 31
  • 3
  • Keyboard keypresses? maybe not python but i've used [autohotkey](https://autohotkey.com/) which is pretty powerful and should be able to do what you want through a small script – zawata Jul 20 '17 at 20:58
  • you should give a try to [openpyxl](https://openpyxl.readthedocs.io/en/default/) or another excel/python module, without sending keys – PRMoureu Jul 20 '17 at 21:09
  • With `pywin32` it's possible to send commands to an excel application: https://stackoverflow.com/a/441786/7306999 – Xukrao Jul 22 '17 at 13:29

1 Answers1

1

If this still helps, you can use from pywin32 (which should be a default package) to use win32com.client.

Sample code:

import win32com.client xl = win32com.client.Dispatch("Excel.Application") xl.sendkeys("^+s") # saves file

Use "%" to access alt so you can get hotkeys.

tuxtuxtux
  • 75
  • 10