Giảng viên ơi, cho em hỏi em muốn load dữ liệu 500 doanh nghiệp lớn từ trang https://vnr500.com.vn/Charts/Index?ch.... nhưng PBI báo lỗi như hình bên dưới, nhờ GV hướng dẫn cách load dữ liệu từ trang web này. Cám ơn GV.
Chào bạn bạn thử vào getdata >blank query >home > advance edittor và copy đoạn code sau vào
let
Source = Web.BrowserContents(" https://vnr500.com.vn/Charts/Index?cha"),
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE[id='dataTables-search'] > * > TR > TH[colspan=""1""][rowspan=""1""]:nth-child(1):nth-last-child(3), TABLE[id='dataTables-search'] > * > TR > TH:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(3)"}, {"Column2", "TABLE[id='dataTables-search'] > * > TR > TH[colspan=""1""][rowspan=""1""]:nth-child(1):nth-last-child(3) + TH[colspan=""1""][rowspan=""1""]:nth-child(2):nth-last-child(2), TABLE[id='dataTables-search'] > * > TR > TH:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(3) + TH:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(2)"}, {"Column3", "TABLE[id='dataTables-search'] > * > TR > TH[colspan=""1""][rowspan=""1""]:nth-child(1):nth-last-child(3) + TH[colspan=""1""][rowspan=""1""]:nth-child(2):nth-last-child(2) + TH[colspan=""1""][rowspan=""1""]:nth-child(3):nth-last-child(1), TABLE[id='dataTables-search'] > * > TR > TH:not([colspan]):not([rowspan]):nth-child(1):nth-last-child(3) + TH:not([colspan]):not([rowspan]):nth-child(2):nth-last-child(2) + TH:not([colspan]):not([rowspan]):nth-child(3):nth-last-child(1)"}}, [RowSelector="TABLE[id='dataTables-search'] > * > TR"]),
#"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"STT", Int64.Type}, {"VNR500", Int64.Type}, {"Doanh nghiệp", type text}})
in
#"Changed Type"
Bạn làm như thầy Tuấn Ba tư vấn nhé, đây sẽ là kết quả, tuy nhiên do cấu trúc bảng ở website này chưa chuẩn nên kết quả sẽ chỉ như này (mong muốn là mỗi dữ liệu ở 1 cột). Thường các web cho dữ liệu ở nguồn mở như GitHub mới lấy được dữ liệu chuẩn