Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Question

JAVA HELP!?

Sep 18, 2012 2:38AM PDT

issue:
I have a google spreadsheet that contains 4 lines that need to be delivered to users to provide login information for a survey (long story). Here's what I need help with:

I need to make a search that will allow users to search by a certain criteria, that will bring up their record from a line in a google spreadsheet
ie
search email address
brings up that line from a spreadsheet

Discussion is locked

- Collapse -
Answer
Why not cheat?
Sep 18, 2012 2:42AM PDT

If I were to do this I'd make their login information be some hash or computation from their login name.

No spreadsheet required. That can be implemented in your javascript.
Bob

- Collapse -
Answer
Java
Nov 15, 2012 1:59PM PST

I suggest a text file instead. Will be simpler for you.
First line should be the column headers. The rest of the lines should be data. Eg.

Name Pass
John asdf
Rick rolled
Jane fdsa

FileReader inFile = new FileReader("filename.ext");
BufferredReader buff = new BufferredReader(inFile);
String line = buff.readline();
System.out.printLn(line); //prints the column header
while (line = buff.readLine()) != null)
{
if (line.indexOf("John") != -1)
{
//print the line like last time
}
}

This would Print

Name Pass
John asdf

This will not compile. You need to wrap it with try catch. Also, you need to create the full class file and the main method. You can also refer to a URL that hosts the file on a site with similar logic but different commands.