Get tabledata from webpage into Excel using macro -


i use excel sheet calculation, assessment of incometax returns. need pull data website excel sheet. did using vba step step

  1. create internet explorer application in vba
  2. navigate website url , login
  3. fill form automatically unique id in excel sheet
  4. now submit form , result page has data in table form
  5. now using getelementsbyid("tableid") copied , pasted data in excel sheet.

my question

  1. all tables don't have id or name
  2. there lot of tables

now want pull data table without id third table top. how this? tried hard. don't want tables because rows in these tables changed when copy tables data.

start macro recording, go data -> web, open required web page in import dialog, select required table, set import options needed, , import data. stop recording.

you boiler plate auto generated macro code, trivial fine turn needs.

i did many times , easy haven't stored snipped share right now.

update: how import question page

sub macro1() ' ' macro1 macro '  '     activesheet.querytables.add(connection:= _         "url;http://stackoverflow.com/questions/18158928/get-tabledata-from-webpage-into-excel-using-macro/18160278#18160278" _         , destination:=range("$a$1"))         .name = "18160278#18160278"         .fieldnames = true         .rownumbers = false         .filladjacentformulas = false         .preserveformatting = true         .refreshonfileopen = false         .backgroundquery = true         .refreshstyle = xloverwritecells ' adjust setting needs         .savepassword = false         .savedata = true         .adjustcolumnwidth = true         .refreshperiod = 0         .webselectiontype = xlspecifiedtables         .webformatting = xlwebformattingnone         .webtables = "1" ' number of required table on page         .webpreformattedtexttocolumns = true         .webconsecutivedelimitersasone = true         .websingleblocktextimport = false         .webdisabledaterecognition = true         .webdisableredirections = false         .refresh backgroundquery:=false     end end sub 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -