aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Getting values from spreadsheet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Getting values from spreadsheet" Watch "Getting values from spreadsheet" New topic
Author

Getting values from spreadsheet

Padmaksha Mukhopadhyay
Greenhorn

Joined: Nov 27, 2012
Posts: 27
Hi Everyone

My program wants to pull data from 4th coloum in a spreadsheet and count number of occurences in a variable

But the answers are comming wrong and not getting updated

Here is my code .

The 4th coloum has arround 50 values like , p0,p1, p2,p3


And the output comes like

Value of P0: 0
Value of P1: 0
Value of P2: 0
Value of P3: 2

Which is absolutely wrong
What am i doing wrong

Kindly help
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

What you're doing wrong is that you are using == to compare strings. Use .equals() instead, for example:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

Wait a minute. Is this Java or JavaScript? Keywords such as "function" and "var" make me think this is JavaScript, which is something completely different than Java.

If it is indeed JavaScript, then my previous answer about using .equals() is not the right answer.
Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
Yep, it is JavaScript.

What's the expected data from sheet.getDataRange().getValues()?

You are looping the data from position 1 (for var i = 1...) is that correct? Also which kind of Object is data? Is it an Array, an Object, a custom Object? You have to provide us with more information to be able to help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting values from spreadsheet
 
Similar Threads
why does it tell me that there is else without if (java programming)?
Declaring Multiple Private Variables
Bezier curve not finishing other half of heart shape properly
please help. division on for loop and array.
sorting multidimensional arrays (int)