LoginSignup
0
1

More than 3 years have passed since last update.

GoogleSpreadsheetのシート情報をExcelに取り込む簡単な方法

Last updated at Posted at 2019-12-17

VBAで出来た既存システムの手動更新が面倒になって来たので、Spreadsheetを編集したら勝手に変わらないかな。って思って色々調べました。

スプレッドシートをシートを全体に公開にして、下記のコードに公開用URLを貼り付けるだけです。
この方法では公開出来ない情報は取り込めません。今回は商品とロケーションコードの組み合わせのみを取得したいだけなので方法を採用しました。

Sub GetSpreadSheetInfo()
With ActiveSheet.QueryTables.Add(Connection:="URL;スプレッドシートのURL", Destination:=Range("A1"))
.Name = "spreadsheet"
.WebFormatting = xlWebFormattingAll
.WebSelectionType = xlSpecifiedTables
.WebTables = "1"
.Refresh
End With
End Sub
※コードの貼り付け方が分からなったです。。。

これが
image.png
こうなります。
image.png

0
1
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
0
1