Read sheet names named by date

I downloaded an excel file, in which there is a sheet named after the file name is the download date, it changes continuously with each download date. I want to read that sheet as default sheet1, what should I do?

Hi,

How about using ForEachExcelSheet as the following?

If there are some sheets except target sheet, the following condition might help you.

System.Text.RegularExpressions.Regex.IsMatch(CurrentSheet.Name,"\b\d{8}$")

Regards,

1 Like

Hi @leanhtuan221200 ,
You can use get work sheet


it return string is sheet name
Chào Tuấn, bạn dùng get work sheet nhé, nó cần vị trí của sheet thôi, sẽ trả về tên Sheet có thể đặt là strSheet,
ở hoạt động read range thì có thể gọi strSheet đó
filter data.xaml (9.7 KB)
regards,
LNV

1 Like

Lưu ý: với sheet của excel sẽ bắt đầu vị trí là 0 nhé Tuấn
ví dụ ở đây mình lấy vị trí (index) 1 sẽ có kết quả là tên của sheet thứ 2



→ ở file của bạn thì hãy chọn index là 0
hope it help
LNV

1 Like

nếu mà muốn đọc file xls thì phải dùng read range modern đúng không ạ, thì ở cái range này thì dòng code phải là như nào ạ
1

Hi @leanhtuan221200 ,
Không nhất thiết dùng read range modern đâu. File xls vẫn là file excel này
đặt nó trong scope của excel vẫn đọc bình thường nhé

1 Like

Còn nếu dùng modern read range thì cần gọi sheet bằng for each sheet
nó sẽ đọc lần lượt từng sheet nếu file có nhiều sheet
cần chỉ định thì mình có thể thêm điều kiện get tên sheet đó
nhưng với file của Tuấn thì có 1 sheet thôi, nên nó đọc bình thường
test.xaml (15.9 KB)
gói modern thì nó cần nhiều scope hơn nên mình thấy dùng cái phía trên mình comment lại ok hơn
dùng cái nào cũng được nhé,

1 Like

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