Read Excel file node Opens Excel file

Hi @Atkins14,
Took so long for me to return to this forum. many thanks for stitching the code, with my basic python knowledge I have edited yours a bit with True or False statement , here below.

from System.IO import Directory
import re
import time
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import subprocess
import os
import errno
import csv
import clr
clr.AddReferenceByName('Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
from Microsoft.Office.Interop import Excel
from Microsoft.Office.Interop.Excel import ApplicationClass
from System.Runtime.InteropServices import Marshal

true_false = IN[0]

def excel_close(_bool):
    if _bool: 
        xlApp = Marshal.GetActiveObject("Excel.Application")	
        xlApp.Visible = True
        xlApp.DisplayAlerts = False
        xlApp.Workbooks.Close()
        xlApp.Quit()
        Check =  "Success"
    else:
        Check = "Set the boolean to True"

    return Check

OUT = excel_close(true_false)

Thanks once again for this working solution.

7 Likes