Copy one sheet from one excel to another without knowing the sheet name

excel

#1

hi,i’m so sorry for having to many issues.
there is two problems i have met:
1).if i don’t know the sheet name (only one sheet in the excel),how can i copy the sheet to another excel;
2) copy column “SUBJECT” in course.xlsx to student.xlsx based on column “ID”,like the following image.student.xlsx (8.7 KB)
course.xlsx (8.6 KB)

%E5%9B%BE%E7%89%87


#2

If you create an output variable(wb) for Excel Application scope (WorkbookApplication)

wb.Sheets(0) should give the only sheetname (If not, may be wb.Sheets(0).Name) for read range.

You can write range the sheet to another excel using the same name.


#3

Hi @chen,

Using Excel Application scope you can achieve this. Workbookapplication.sheet(0)
Refer the below xaml files.

student.xlsx (9.5 KB)
Sheets.xaml (16.2 KB)

course.xlsx (8.6 KB)


#4

wb.GetSheets(0)
:stuck_out_tongue: That’s what I use.

Not sure .Sheets() will work but maybe it will?

@chen, Just to add, .GetSheets() creates an array so you can filter it or run it through a For Each.
To straight up filter it use some vb.net which if you are not sure that information can be looked up.

wb.GetSheets.Where(Function(x) x.ToString.Trim.StartsWith(Now.ToString("mm-dd")).ToArray(0)

The above example would pull in the sheet where the current date is on the sheet name.

Regards


#5

Hangover Typing :stuck_out_tongue_winking_eye:


#6

if i want to merge one column(if another column(ARTIST) in course) from course to student,can there be any invoke method.
the result like this:


#7

Hi @chen,

use Remove Data Column activity to remove the ARTIST Column from the table.

Regards,
Arivu


#8

can i only merge one specified column at the first