如何从网站提取数据到Excel?

时间:2014-05-27 12:44:21

标签: excel web

this网站,有以下值(位于中间):

Item EAN:   2724283785925
Sold by: GreenDiamond

我想要的是知道如何将值提取到Excel"或任何程序"所以专栏" A"是项目EAN"的列表(这是不可变的,我手动输入)和列" B"是"出售的提取数据:" (这是可变的)

你能帮我吗?

我认为我们可以使用MACRO 像这样的东西

Sub queryURL()

myURL = "URL;http://a810-bisweb.nyc.gov/bisweb/PropertyProfileOverviewServlet?boro=" & Range("A1") & "&houseno=" & Range("A2") & "street=" & Range("A3") & "&go2=+GO+&requestid=0&t10=y"

With ActiveSheet.QueryTables.Add(Connection:=myURL, Destination:=Range("A9"))
End With
End Sub

1 个答案:

答案 0 :(得分:-1)

这是示例代码:

import java.io.File;
import jxl.*;
import jxl.write.*;
 /**
 *
 * @author Guokai.Wang
 */
 public class ExcelCreator 
 {
  /**
 * @param args the command line arguments
  */
  public static void main(String[] args)
   {
    // TODO code application logic here
    Cell cell;
    EN n1 = new EN(0, 3, 1.00);
    Label label = new Label(0, 2, "A label cell");
    // NumberFormat n_f = new NumberFormat(NumberFormat.CURRENCY_DOLLAR);
    // WritableCellFormat currencyFormat = new WritableCellFormat(n_f);
    WritableSheet sheet;
    WritableWorkbook book;

    try
    {
        book = Workbook.createWorkbook(new File("test.xls"));
        sheet = book.createSheet("First", 0);

        // n2 = new EN(0, 4, f, currencyFormat);

        sheet.addCell(label);
        sheet.addCell(n1);
        // sheet.addCell(n2);

        cell = sheet.getCell(0, 2);
        System.out.println(cell.getContents());

        book.write();
        book.close();
    }
    catch(Exception exception) {exception.printStackTrace();}
    }
   }

你必须下载jxl.jar