How should I set this? (append and read range)

Hi All,

I’m using Studio X version.

My automation downloads 3 excel files from the website. I then, would like the automation to: create new excel file on my computer and copy the contents of these three files into 1 (just like in attached screenshot). Do you have any ideas how can I bite this with the StudioX version?

I want raport 1 raport 2 and raport 3 to be merged into “destination report” but I have no idea how to use the append range activity. Do you have any tips? This is what I came up with:

GlobalHandlerX.xaml (73.6 KB)
Main.xaml (14.8 KB)
project.json (1.5 KB)
Project_Notebook.xlsx (39.7 KB)
RuntimeExecutionError_Template.html (8.2 KB)

Hi @anon40731888

Read the excel2 data using read range activity and store the data in a variable say excel2
Read the excel3 data using read range activity and store the data in a variable say excel3
use append range activity and in place of excel path please mention the excel file path and in place of sheet name please mention the excel1 sheet name and in data table variable2 please mention the data table variable say excel2 and again take the append range and all the paths are same but replace the excel2 with excel3.
image

@anon40731888

Follow the steps

  1. Use for each file in folder activity and give the folder pth where excel files are present
  2. Use read range activity and pass the currentfile.fullname as path and save output to datatable dt
  3. Now use path exists activity and check if the final output file is present this activity gives true or false as output …(try placing the output file in a different folder than the ones where input files are present)
  4. Use if condition and give output of path exists
  5. On then side use append range activity and pss the output file pth and dt as the data
  6. On else side use write range with same output file path and the datatable dt

This works with any number of files.assuming the folder contains only there 3 files
Also using path exists to check if file already present then appending the data and if not present creating it (write range creates the file as well)

Hope this helps

Cheers

Hi,

This is good idea.

The problem is that I’m using the StudioX and I don’t really know where to use the variables, please have a look:
GlobalHandlerX.xaml (73.6 KB)
Main.xaml (15.0 KB)
project.json (1.5 KB)
Project_Notebook.xlsx (39.7 KB)
RuntimeExecutionError_Template.html (8.2 KB)

If you have same columns in every Excel fill you can use marge datatable that will append the data.

Other wise you can use append range activity

This is where I’m stuck:

I’m not sure how to set this in yellow. I assume I should use variable “raport 2” and “raport 3” there? but there is no option to enter variable? [Sorry I’m a begginer]



@anon40731888

You eould give the raport2 as the value there which is the output of reading. Excel 2 similarly have one more for excel 3

Cheers

1 Like

Hi @anon40731888

Please try using append range workbook activities instead of append range excel activities.

this

There is no such activity.

I found this, is that correct?

Hi @anon40731888

Please click the append checkbox and in destination field give the excel path in which the data to be written and in what to write please mention the data table variable.

1 Like

THANK YOU! IT WORKS!

Thank you, I was using incorrect activity :(. It is working now.

1 Like

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