Write Range: Archive file cannot be size 0

I keep receiving the “Write Range: Archive file cannot be size 0.” error. I don’t know what to do with it. This Write Range is the UiPath.Excel.Activities.WriteRange (Excel not required) one.

image

This happens if you used a Create File activity to create an Empty Excel File.

The minimum size of a file created manually from Excel is 1 KB. Therefore anything less than that cannot be accessed in Excel.

When you use Workbook Write Range activity, the file will be created for you if it does not already exist. Therefore, there is no need for you to create the file separately before you write to it.

Thank you Andy.

I tried it with and without creating the file first. Same error both times. What was strange was that I moved it on to my Desktop computer and it ran with no problems.

I run Windows in Virtual Box on my laptop. I wonder if there is some strange magic going on there?

You should check the task manager the excel.exe is close or use Excel Application Scope
Screenshot 2021-05-14 095315

Hi @wood.raymond79 ,

I was alluding to giving this a shot using the Workbook write range activity instead of the Excel Write range activity.

If your Robot is working inside of the Virtual Box the file path should not really matter. Can you use an absolute file path instead of the relative path in your Write Range? One never knows. It might be that simple.

Finally if you are using the Excel App Scope container make sure to use the Close Workbook as the last action so that the Robot releases the lock on the file.

Thanks Eric. I don’t have Office installed.

Have a great day!

Raymond Wood
wood.raymond79@gmail.com

Thanks Andy.

I do not have Office installed.

As an alternative to Write Range to Workbook, I chose to write to a CSV file. It worked just as well. This is only a training exercise for me so a solution is not required although this is a curious case.

Should I close this issue or is it worth digging into?

Have a great day!

Raymond Wood
wood.raymond79@gmail.com

I guess it’s okay to close this thread if your objective has been met for this exercise. For future revisits I would like to mention that, as you don’t have Office installed, the Workbook Write Range activity should work as it is meant to for environments that do not have Excel installed.

You have a great day too! :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.