Hello,
I am trying to achieve a working method which allows me to detect and import data by Selection from an active/open Excel file. The goal is to detect the selected data from the open Excel file.
I’ve seen a similar to concept to import geometries from an open Autocad file in the LinkDWG package.
Thanks to Koz Jono YEOH I have the following code. However I have an error and empty list
Thanks in advance
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
try:
import os
except:
sys.path.append(r"C:\Program Files (x86)\IronPython 2.7\Lib")
import os
rtn="Input Excel file to open"
xls=IN[0]
if xls and os.path.exists(xls):
try:
from System import Type, Activator
t=Type.GetTypeFromProgID("Excel.Application")
r=Activator.CreateInstance(t)
r.WorkBooks.Open(xls)
r.Visible=True
rtn=[r, r.ActiveDocument]
except: rtn="Exception found"
OUT = rtn