Task. A program for copying data from an Excel table and pasting it into the Discord command line (Midjourney), using the openpyxl library for working with Excel.
Problem.
Not copied from Excel
It gives the following error.
Discord 1.0.9013
Exit from the secondary instance.
**************
Problem.
Not copied from Excel
It gives the following error.
Discord 1.0.9013
Exit from the secondary instance.
**************
import subprocess
import time
from openpyxl import load_workbook
# Opening an Excel file
workbook = load_workbook('c:\AutomationMJ\copyExcelTOmj.xlsx')
# Selecting a letter in an Excel table
worksheet = workbook['Sheet1']
# List of cells from which to copy data
cells_to_copy = ['A1', 'A2', 'A3']
# Loop for each cell
for cell_reference in cells_to_copy:
# Get the value from the selected cell
cell_value = worksheet[cell_reference].value
# Opening Discord in the background and passing a value via standard input
command = ['C:\\Users\\irave\\AppData\\Local\\Discord\\app-1.0.9013\\Discord.exe', '/imagine', ' ' + str(cell_value)]
process = subprocess.Popen(command, stdin=subprocess.PIPE)
process.communicate()
# Delay of 10 seconds before opening the next Discord process
time.sleep(10)
buran write Jun-01-2023, 08:39 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
