I have a spreadsheet with a column "D" that has a list of file paths, and there are about 2500 files in this column. In column "E", I have a list of equal size with the new destination file path. I want to copy all the files in column D to the locations in column E. I know it's possible using a Python / Basic macro in LibreOffice, but I can't seem to get it right.
This is the VBA code I found while searching, but unfortunately it doesn't work with LibreOffice Calc.
Sub Copy_Files()
Dim cell As Range
For Each cell In Range("D1", Range("D" & Rows.Count).End(xlUp))
FileCopy Source:=cell.Value, Destination:=cell.Offset(, 1).Value
Next cell
End Sub
I don't know any Python, but if someone put me on the right track I could work it out.
I tested the following, and it worked:
I believe you just need to make sure the destination path also contains the file name. Also, you need to enable "Microsoft Scripting Runtime" reference ("C:\windows\system32\scrrun.dll")