中易网

怎么用EXCEL调用网站的API数据?

答案:2  悬赏:70  
解决时间 2021-02-28 04:54
请问如何把网站中的API数据整理到EXCEL表格中并进行计算?类似一下api
http://data.bter.com/api/1/ticker/btc_cny

谢谢!
最佳答案
这个返回的是JSON格式,要用JS翻译下再转入EXCEL中
全部回答
这是我以前写的一段程序,可以参考。 现在没有安装office,没法试了。 你在百度文库里找“使用mfc操作excel文件”就可以找到资料。 _application app; // app is an _application object. workbooks books; lpdispatch lpdisp; // often reused variable. if(!app.createdispatch("excel.application")) { afxmessagebox("couldn't createdispatch() for excel"); return; } // set visible. app.setvisible( false ); lpdisp = app.getworkbooks(); // get an idispatch pointer. assert(lpdisp); books.attachdispatch(lpdisp); // attach the idispatch pointer colevariant covtrue((short)true), covfalse((short)false), covoptional((long)disp_e_paramnotfound, vt_error); // to open an existing workbook, you need to provide all // 13 arguments for the open member function. // the code below opens a workbook and adds it to the workbook's // collection object. // you need to modify the path and file name for your own // workbook. // cstring strfile = filename; lpdisp = books.open( strfile, // is a workbook. covoptional, covoptional, covoptional, covoptional, covoptional, covoptional, covoptional, covoptional, covoptional, covoptional, covoptional, covoptional ); // return workbook's idispatch pointer. assert(lpdisp); book.attachdispatch( lpdisp ); // get the sheets collection and attach the idispatch pointer to your // sheets object. lpdisp = book.getsheets(); assert(lpdisp); sheets.attachdispatch(lpdisp); long nsheets = sheets.getcount(); char outfile[256]; for (long no = 1; no <= nsheets; no++) { lpdisp = sheets.getitem( colevariant((short)( no )) ); assert(lpdisp); sheet.attachdispatch(lpdisp); lpdisp = sheet.getusedrange(); assert(lpdisp); range.attachdispatch(lpdisp); variant ret = range.getvalue(); if ( ret.vt == vt_empty ) continue; strcpy(outfile, filename); char *p = strchr( outfile, '.' ); if ( p ) *p = 0; cstring str = outfile; str += "_"; str += sheet.getname(); if ( str.find( "说明" ) == -1 && str.find( "说明" ) == -1) { str_command[ 0 ].add( str ); int sign = -1; ftalk->write( (const char*)&sign, 4 ); int n = str_command[ 0 ].getsize(); ftalk->write( (const char*)&n, 4 ); strcat(outfile, (lpcstr)sheet.getname()); strcat(outfile, ".cxx"); //std::ofstream ar(outfile); std::ofstream ar; //ar << (lpcstr)sheet.getname() << std::endl; //create the safearray from the variant ret. colesafearray sa(ret); saveastalk( ar, sa ); } }
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
天使幼儿园怎么去啊,有知道地址的么
创造怎么造句。创造怎么造句
景合燃气LNG加气站便利店在什么地方啊,我要
女孩比我大7岁,我们能在一起吗? 我18岁,我
圆月的意思是什么?圆月的释义是什么啊?
每天锻炼一小时很重要 怎么用英语说
美之·缘SPA女子专业会所在什么地方啊,我要
计算机科学与技术和计算机应用一样吗哪个比较
急,酒店未成年人可以入住吗但我有身份正
想在弹个车加盟一个奶茶店觉得好吗,有没有大
银桥劳务服务有限公司在什么地方啊,我要过去
冀HA393车主?
篮球封盖触筐出界的判定
学海路地址在什么地方,想过去办事
捷安特xtc车架尺寸l是多大
推荐资讯
怎样应对刷脸机,有什么好办法呢?
德克士畅饮杯能不能续杯啊 传说中活动期间内
奇志和大兵是怎么搞翻的?
CNC磁盘哪个公司生产的好?
唱吧的等级为大帝共需要多少金币?
华中师范大学学科教学(地理)专业硕士每年的
上海南到义务金华的火车列表
桂言叶和泽永泰介发生了性关系吗
乱乱台在什么地方啊,我要过去处理事情
快易拍高拍仪跟鼎易是什么关系?
拨音碗干啥用的l藏传佛教用的吗·
绿源鲜奶吧(铁西九道街)我想知道这个在什么地
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?