web頁(yè)面實(shí)時(shí)更新數(shù)據(jù) 如何做到EXCEL數(shù)據(jù)與網(wǎng)絡(luò)web獲取數(shù)據(jù)并實(shí)時(shí)更新?
如何做到EXCEL數(shù)據(jù)與網(wǎng)絡(luò)web獲取數(shù)據(jù)并實(shí)時(shí)更新?這個(gè)問(wèn)題設(shè)置有點(diǎn)復(fù)雜,大致步驟:打開excel,選擇數(shù)據(jù)--自網(wǎng)站,打開新建web查詢對(duì)話框,在地址欄輸入數(shù)據(jù)所在網(wǎng)頁(yè)的網(wǎng)址,點(diǎn)擊轉(zhuǎn)到就會(huì)打開網(wǎng)頁(yè)
如何做到EXCEL數(shù)據(jù)與網(wǎng)絡(luò)web獲取數(shù)據(jù)并實(shí)時(shí)更新?
這個(gè)問(wèn)題設(shè)置有點(diǎn)復(fù)雜,大致步驟:打開excel,選擇數(shù)據(jù)--自網(wǎng)站,打開新建web查詢對(duì)話框,在地址欄輸入數(shù)據(jù)所在網(wǎng)頁(yè)的網(wǎng)址,點(diǎn)擊轉(zhuǎn)到就會(huì)打開網(wǎng)頁(yè),進(jìn)入網(wǎng)頁(yè)后點(diǎn)擊隱藏或顯示圖標(biāo)按鈕,在網(wǎng)頁(yè)選擇數(shù)據(jù)區(qū)域,再點(diǎn)擊導(dǎo)入,設(shè)置存放數(shù)據(jù)的工作表等相關(guān)內(nèi)容即可。
做一個(gè)電子表格excel vba實(shí)時(shí)獲取網(wǎng)頁(yè)數(shù)據(jù)?
Excel界面操作:數(shù)據(jù)——導(dǎo)入外部數(shù)據(jù)——新建Web查詢:在出現(xiàn)的界面地址欄輸入網(wǎng)址,然后選擇需要更新的數(shù)據(jù)范圍——導(dǎo)入——選擇數(shù)據(jù)放的單元格(必要時(shí)修改屬性,如刷新頻率等)——確定。這樣當(dāng)網(wǎng)頁(yè)數(shù)據(jù)變化時(shí),Excel表格的數(shù)據(jù)就會(huì)同樣改變。如果非要用VBA,用錄制宏稍作修改即可。
如何獲取實(shí)時(shí)的股票數(shù)據(jù)?
可以通過(guò)調(diào)用ChinaStockWebService的服務(wù)來(lái)實(shí)現(xiàn)獲取股票的實(shí)時(shí)數(shù)據(jù),代碼如下: public string[] getStockInfo(string stockcode) { //string url = "http://hq.sinajs.cn/list=" stockcode //stockcode 某只股票的代碼 string url = "http://hq.sinajs.cn/list=sh600683" WebClient client = new WebClient() client.Headers.Add("Content-Type", "text/html charset=gb2312") Stream data = client.OpenRead(url) StreamReader reader = new StreamReader(data, Encoding.GetEncoding("gb2312")) string s = reader.ReadToEnd() reader.Close() data.Close() return s.Split(",") }