Worksheet quick handle is not a member of string()

Hi there,

Can anyone help me on this syntax
i would like to read specific sheets from “For Each Excel Sheet” - CurrentSheet
i have aprox.5 worksheet but only want to read 3 of them.
I input assign but the error message say "WorksheetQuickHandle error BC30456 is not a member of string().
thanks
CurrentSheet_QuickHandle

Hi,

Can you try as the following?

sheets = {"Settings","foobar1","foobar2"}

Then use the following expression in IF activity

sheets.Contains(CurrentSheet.Name)

Regards,

Hi @YangYang ,
Please check type of variable “CurrentSheet”
It must be list of String

regards,

Thank Yoichi,
so there is no syntax that could just convert quickhandle to array?
just like the For Each Row using CurrentRow.ToDataTable.Rows kinda syntax…
Thanks

Hi Nguyen_Van_Luong1,

i am using modern design in VB, Windows
CurrentSheet is a WorksheetQuickHandle Variable type
thanks

Hi,

Which type of array do you need?

if datarow array, the following may help you.

CurrentSheet.DataTableValue.AsEnumerable.ToArray()

Or

Excel.Sheet("Sheet1").DataTableValue.AsEnumerable.ToArray()

Regards,

Hi Yoichi,

Sorry for the confusion.
if i do not want to use the IF activity and just want to assign to array directly, is there a conversion syntax?
CurrentSheet = ?

Hi,

Which do you need WorksheetQuickHandle or Array of WorksheetQuickHandle?

If former the following will work

If latter, can you try the following?

image

arrWSQ = sheets.Select(Function(s) Excel.Sheet(s)).ToArray

Regards,

Hi Yoichi,

the syntax for the latter not working
both i assign to String Array
Error: BC30332. Value of type “WorksheetQuickHandle()” cannot be converted to String() because WorksheetQuickHandle is not derived from String.

Hi,

Did you set left side variable as Array Of WorksheetQuickHandle type?

Regards,

Screenshot 2023-11-21 114806

HI,

The latter expression returns Array Of WorksheetQuickHandle type.

Regards,

Hi Yoichi,

there is another error after assigning worksheetquickhandle in array when i uses it in for each excel row.
my final intention is to assign each row to a config file key value assign.

If you need to use ForEachRow for each sheet, it’s unnecessary to use WorksheetQuickHandler array. How about the following?

Understood.
Thanks Yoichi.

1 Like

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