Write Range inside a Macro file(.xlsm) from xlsx file

Hello everyone,

I Have a .xlsm file(Macro file) and I have data in another excel file(.xlsx). I need to copy the range from .xlsx file and write into.xlsm file, both files are in my OneDrive
I used Read Range activity for excel and save the range in a Variable

Then Used excel application scope and chose the xlsm file and write range, and i have this error message :

Write Range: An unspecified error has occurred.

Do you have any ideas?

Thanks

@Maxime_LAUGIER

Ideally you should be providing the one drive url

instead what you can do is to copy the file o local folder and then try read rage or copy/paste range activity

cheers

@Maxime_LAUGIER,

If you are looking for running any macro on .xlsm file then you should be using Read range O365 activity to read data into DataTable and then on local .xlsm you should writing range.

Thanks,
Ashok :slight_smile:

Hello @Anil_G ,

I’ve just tried this method, but unfortunately my data isn’t imported into the file.
Especially since it changed the columns…

Thanks

Hello @ashokkarale & @Anil_G

it is possible for you to simulate it and provide me the main.xaml?
Is is the 2 files, and i need to put the data from TESTFACTURE_V2 (28).xlsx in the sheet “LIL” to the file LIL_CA et Marges 2023 RPA test.xlsm at the buttom.

For your information, the TESTFACTURE_V2 (28).xlsx file changes each time the script is run.
The 2 files are in my OneDrive shared folder

Thanks

oops, i can’t upload xlsx files


@Maxime_LAUGIER

Please use append range instead of write range

Cheers

Hello @Anil_G

I won’t be able to copy locally as this script will later be on a VM

I’ve just made the changes and I get this error:

Get File/Folder: The caller is not authorized to perform this action.
I’ve just checked with the IT department that I have write and read rights for this shared Gdrive folder.


@Maxime_LAUGIER

As per error may be you dont have access to the full folder youa re trying to access and may have access only to the file which might not be enough

Cheers

@Anil_G ,

We’ve moved the folder to another shared Gdrive environment, and the error persists: Write Range: The caller is not authorized to perform this action.

@Maxime_LAUGIER

please check the permission scope that is required

cheers

Hello everyone,

i would like to thank you everyone, we manage to fix the issue.
Basically, i read range from the Excel application scope and save it to a DB (initially Build at the top of the script)

And the solution for Gdrive is to use Append Range Workbook with the path as variable. And the data will be automatically add at the buttom of the Excel sheet.

Thank you everyone

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