You can do it with the help of .uno:
commands.
The codelines below are not tested (“Written on dry ground.”)
Errors expected!
===Editing 2018-12-06 23:50 (UTC+01:00)===
Errors were present. They were commented and corrected in the below code.
...
dispH = CreateUnoService("com.sun.star.frame.DispatchHelper")
sourceSheet = oCSV.Sheets(0)
sourceRangeStart = sourceSheet.GetCellByPosition(0, 0)
rangeCursor = sourceSheet.CreateCursorByRange(sourceRangeStart)
rangeCursor.GotoEndOfUsedArea(True)
oCSV.CurrentController.Select(rangeCursor)
frCSV = oCSV.CurrentController.Frame
dispH.ExecuteDispatch(frCSV, ".uno:Copy", "", 0, Array()) REM Correction: Two parameters inserted.
otherUrl = "/FolderPath/targetFile.ods"
REM Assignments are examples:
targetSheetNum = 3
targetCellName = "Z1"
REM ... Change as you need it.
otherDoc = StarDesktop.LoadComponentFromUrl(otherUrl, "_blank", 0, Array())
targetSheet = otherDoc.Sheets(targetSheetNum)
targetCell = targetSheet.GetCellRangeByName(targetCellName)
otherDoc.CurrentController.Select(targetCell)
frOther = otherDoc.CurrentController.Frame
dispH.ExecuteDispatch(frOther, ".uno:Paste", "", 0, Array()) REM Correction: Two parameters inserted.
otherDoc.Store()
otherDoc.Close(True)
...
Another way avoiding the “slot machine” dispatcher is to use the DataArrays:
...
sourceSheet = oCSV.Sheets(0)
sourceRangeStart = sourceSheet.GetCellByPosition(0, 0)
rangeCursor = sourceSheet.CreateCursorByRange(sourceRangeStart)
rangeCursor.GotoEndOfUsedArea(True)
otherUrl = "/FolderPasth/targetFile.ods"
REM Assignments are examples:
targetSheetNum = 3
targetCellX = 25 : targetCellY = 0
REM ... Change as you need it.
otherDoc = StarDesktop.LoadComponentFromUrl(otherUrl, "_blank", 0, Array())
targetSheet = otherDoc.Sheets(targetSheetNum)
REM Faulty original LOC (2 serious errors): With sourceRange
REM Corrected LOC:
With rangeCursor.RangeAddress
targetRange = targetSheet.GetCellRangeByPosition( _
targetCellX, targetCellY, _
targetCellX + .EndColumn - StartColumn, targetCellY + .EndRow - .StartRow)
End With
targetRange.SetDataArray(rangeCursor.GetDataArray())
otherDoc.Store()
otherDoc.Close(True)
...