Created
December 31, 2024 13:50
-
-
Save vmetnev/8d730fe25899c96d1af790882e27dae9 to your computer and use it in GitHub Desktop.
WritingOpenExcel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python -m pip install --index-url=https://blpapi.bloomberg.com/repository/releases/python/simple/ blpapi | |
# python -m pip install pywin32 | |
# pip install pypiwin32 | |
# pip install win32com.client | |
import win32com.client as win32 | |
# Connect to the running instance of Excel | |
excel = win32.Dispatch("Excel.Application") | |
workbook = excel.Workbooks("Ex.xlsx") # Name of your workbook | |
sheet = workbook.Sheets("Q1") # Name of your sheet | |
# Write data to a specific cell | |
sheet.Cells(1, 1).Value = "Eftihia22" | |
print(sheet.Cells(4, 1).Value) | |
# Save changes (optional) | |
workbook.Save() | |
print("ds") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment