1

I'm using Excel on a Windows server to convert Excel to PDF. I want to know whether I can start Excel via Golang or Node.js on a Windows server. I see some examples of running Excel Application by Ruby, Python, C#. For example:

require 'win32ole'

class TestDemo < Test::Unit::TestCase
   def testExcelMacro
    # Arrange
    excel = WIN32OLE.new("Excel.Application")
    excel.Visible = true
    excel.Workbooks.Open('C:\temp\Test.xlsm')

    # Act
    excel.run "Sheet1!WriteToA1"

    # Assert
    worksheet = excel.Workbooks.ActiveWorkbook
    assert_equal("blah", worksheet.Range("A1").Value)

    excel.Quit  
   end
end
from win32com import client
xlApp = client.Dispatch("Excel.Application")
books = xlApp.Workbooks.Open('C:\\excel\\trial.xls')
ws = books.Worksheets[0]
ws.Visible = 1
ws.ExportAsFixedFormat(0, 'C:\\excel\\trial.pdf')
TylerH
  • 20,799
  • 66
  • 75
  • 101
Tran B. V. Son
  • 759
  • 2
  • 12
  • 31

1 Answers1

0

If talk about node.js you can use winax library or something similar for work with activex/com/dcom. But I believe you can use just build-in in windows javascript interpreter (not node.js) for it.

Yaroslav Gaponov
  • 1,997
  • 13
  • 12