7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Googleスプレッドシートで特定キーワード検索結果を取得

Posted at

例えば、VORKERS( http://www.vorkers.com/ )という会社評価のクチコミサイトで、個別の企業ページの情報を複数取得したい場合、まずは企業ページのURLを得る必要があります。しかし、企業名と企業ページURLに関連性がない場合(ページURLが連番で生成されているなど)、1つずつ手動で企業ページURLを取得するのは面倒です。
そこで、サイト上でキーワード検索をし、検索結果から企業ページのURLを取得すると便利です。

やり方

下記のようなGoogleスプレッドシートを想定し、説明します。
画像.png

B1セルに、検索したい企業名を入力します。続いて、B3セルB4セルB5セルにはそれぞれ下記のように関数を入力します。すると、B5セルB1セルに入力したキーワードで検索した結果ページのURLが表示されます。

B3セル
="http://www.vorkers.com/search.php?src_str="&B1
B4セル
=IMPORTXML(B3,"//div[@class='table-noSequence_companyName']/a/@href")
B5セル
="http://www.vorkers.com/"&B4
7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?