importhtml每个URL中不同数量的列会引发错误,并进一步需要移动/随机排列列

问题描述

我正在尝试导入具有不同列数的表。这导致出现错误“在ARRAY_LIteraL中,数组文字缺少一个或多个行的值”,看来列数应该相同。

我还需要有关输出中第二个URL表的帮助:

a)B列应位于 G “ H”列

b)像第二个URL表输出中那样,对列进行洗牌,C,D列应在B,C列中。 E,F列应为F,E。 )

工作表已附加here

解决方法

您的第二个导入表输出#N / A,因此您实际上是将6列以一个列/一个单元格放置在数组中

enter image description here


如果您仍要继续使用,请使用:

=QUERY({
 IFERROR(QUERY(IMPORTHTML(
 "https://www.financialexpress.com/market/stock-market/nse-top-gainers/","table",2),"where Col1 is not null",1),{"","",""});
 IFERROR(QUERY(IMPORTHTML(
 "https://www.financialexpress.com/market/stock-market/nse-buyers/","where Col1 is not null offset 1",0),""})},0)

enter image description here


更新:

=QUERY({
 IFERROR(QUERY(IMPORTHTML(
 "https://www.financialexpress.com/market/stock-market/nse-top-gainers/","select Col1,' ',Col2,Col3,Col4,Col5,Col6 
  where Col1 is not null 
  label ' ''Bid Qty'",1)

enter image description here