• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Read\Write\Search a word in Excel using Java

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have an excel file. Using POI, I am able to read the contents and write contents to it.

But my specification is to read the value of a particular cell and write a value to the particular cell.

Search a value in a specific column.

I need to do this using JAVA.

Thanks in Advance.

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are able to "read and write a spreadsheet", how is that different from "reading and writing particular cells" of a spreadsheet? In other words, what do you have so far, and where are you stuck making progress?
 
Dhivya Krishnan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wanted to search using a particular word.

I fetched a column using columns name., adding all the column values to an arraylist and searching if the value is there in the list.

Can you please tell me which collection to use. Hash map, Arraylist,linkedlist or anything else.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What would be the point of this additional data structure? It seems you could just as easily iterate over rows and columns...?

Otherwise, a List of Lists might work for representing a sheet.
 
Dhivya Krishnan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me clearly explain the requirement, Please guide me the best approach.
I need to fetch data from excel file and upload them in a form.

Below are the constraints.
1. The number of columns or the position of the columns is not fixed.
2. Need to sort the content based on a column.
3. Search for a value in the specified column and fetch the entire row.

Ex: The excel has Name|ID|Age|Address| as columns.
The number and position of columns might vary.
Need to sort the content based on id and fetch the compelte row of id 123456.

Please suggest me the best approach.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the connection between #2 and #3? Sorting and searching are orthogonal activities. Or do you intend to implement something like binary search?

Also, what is the "upload" part about? Upload what - all the data form the file, some of the data from the file, ... ?
 
Dhivya Krishnan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its not like binary search.

Column 1 | Column 2 | Column 3 | Column 4
AT ABC 123 JUNK1
EU XYZ 456 JUNK2
US ABC 789 JUNK3

In the table above., I need to filter the table column 2 with ABC. I will end up having two rows. Now I need to search in column 1 for AT and fetch the complete row details.

 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Dhivya Krishnan

Does that not simply equate to:

Return all the rows where column1="AT" and column2="ABC"?
 
reply
    Bookmark Topic Watch Topic
  • New Topic