下面是我的代码,它将从 URL 读取行并输出它。我想知道如何在 excel 中输出行号,例如行号。
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Scanner;
public class helloworld {
public static void main(String[] args) throws IOException {
URL yahh = new URL("https://docs.google.com/spreadsheet/pub?key=0AqSBI1OogE84dDJyN0tyNHJENkNyYUgyczVLX0RMY3c&single=true&gid=0&range=A2%3AA200&output=txt");
BufferedReader in = new BufferedReader(
new InputStreamReader(
yahh.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
当前输出为:
11111
22222
33333
44444
55555
66666
77777
88888
99999
100000
我希望它是
1 11111
2 22222
3 33333
4 44444
5 55555
6 66666
7 77777
8 88888
9 99999
10 100000