Skip to content

Instantly share code, notes, and snippets.

@vmetnev
Created December 31, 2024 13:50
Show Gist options
  • Save vmetnev/8d730fe25899c96d1af790882e27dae9 to your computer and use it in GitHub Desktop.
Save vmetnev/8d730fe25899c96d1af790882e27dae9 to your computer and use it in GitHub Desktop.
WritingOpenExcel
# 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