Can one pass a variable from powershell or cmd to an ods/xls file? [closed]

asked 2014-12-13 11:29:45 +0200

jobzombi gravatar image

In excel I do the following command in Powershell:

$a = New-Object -ComObject Excel.Application
$a.Visible = $True
$b = $a.Workbooks.Add("\\networkdrive\IPAddresses.xls")
$c = $b.Worksheets.Item(1)
$c.Cells.Item(3,3) = "$Oct"
$c.Cells.Item(2,3) = "$Loc"

The the xls file has a formula for the cells that takes the octet data given in $Oct and adds it to list IP address for a given location ($Loc) Works fine for excel, but I wish to do the same with SCalc. Does this:

cell 3,3 is D3, so if $oct equals 6.123, and if cell E6 has ="10.12"&D3&".150" I get 10.126.123.150.

there is no object named scalc.application to use in powershell, that I know of, so the only way I have somewhat come up with doing this is by converting it to and xml file and finding the line for the cell in question, replacing it, saving a temp copy elsewhere and opening that. The issue is that well, I'll end up having to create one xml file that will be used to save over 1000 temp xml files of which then I cannot delete, since once the file opens, I cannot delete it while in use, and after running the script, there is now way to keep track of the xml file name to delete once it closes, the script in question will loop back to the beginning to await another command, so it and the xml file could be used at the same time, rather than have the powershell script wait for Scalc to close, which then I could have it delete the file, but will leave it unusable for the time being used.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2016-03-07 01:53:41.553727