Ok. So I inherited of an old spreadsheet that was passed from hand to hand over time.
At opening this spreadsheet seems to try connecting to another spreadsheet as it shows "Linking: [filename.xls] ..." at the bottom of Excel. As you guessed, I have no clue what that other spreadsheet is.
I have found different "solutions" to remove this link (inspection of all types of objects in the spreadsheet, find/recplace, ...) on the internet but none has worked for me.
But maybe you guys have some day had the same issue and actually found a solution?
Many thanks.
Function RunPython()
Dim obj As Object
Set obj = CreateObject("WScript.Shell")
RunPython = obj.Run("pythonw.exe C:/ ..../my_great_snippet.py", 0, True)
End Function
from openpyxl import Workbook
from openpyxl import load_workbook
import datetime
wb = Workbook()
ws = wb.active
ws1 = wb.create_sheet("Mysheet")
ws1 = wb.create_sheet("Tagoma")
wb.save("C:\ABC\XYZ\DD.xlsx")
wb = load_workbook("C:\ABC\XYZ\DD.xlsx")
ws1 = wb.create_sheet("Tagoma2")
ws1['A1'] = datetime.datetime(2021, 8, 29)
ws1.append([1, 2, 3,4])
print(wb.sheetnames)
wb.save("C:\ABC\XYZ\DD.xlsx")
from openpyxl import Workbook
wb = Workbook()
# grab the active worksheet
ws = wb.active
# Data can be assigned directly to cells
ws['A1'] = 42
# Rows can also be appended
ws.append([1, 2, 3,4])
# Python types will automatically be converted
import datetime
#ws['A2'] = datetime.datetime.now()
# Save the file
wb.save("C:\ABC\XYZ\sample.xlsx")
I was confusing xlwings with XLw
https://xlw.github.io/
So, I take it back
Still, maybe a bit of redesign is an idea.........
many constraints from company's IT
non-sensical constraints?