Created
March 15, 2025 14:23
-
-
Save vmetnev/0bc889e24afcfe5fe38be3f00822f8c5 to your computer and use it in GitHub Desktop.
write to open excel
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
import pandas as pd | |
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 = "Vladislav22" | |
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