How to print a particular cell data from .xls file
InputStream inputStream =new FileInputStream("D:\\test.xls");
POIFSFileSystem fileSystem=new POIFSFileSystem (inputStream);
HSSFWorkbook workBook = new HSSFWorkbook (fileSystem);
HSSFSheet sheet = workBook.getSheetAt (0);
Iterator<HSSFRow> rows = sheet.rowIterator ();
HSSFRow row = rows.next ();
Iterator<HSSFCell> cells = row.cellIterator ();
HSSFCell cell = cells.next ();
can any get me answer to print the particular cell from the excel sheet.
Regards
Praveen
Thank you for your response
when i written the in following way
HSSFWorkbook workbook = new HSSFWorkbook(new
FileInputStream("D:\\sam.xls"));
HSSFSheet sheet = workbook.getSheetAt(1);
HSSFRow row = sheet.getRow(0);
HSSFCell cell = row.getCell((short)3);
int as= sheet.getFirstRowNum();
int bs=sheet.getLastRowNum();
System.out.println("Begin of row"+as);
System.out.println("End of row"+bs);
Is Displayed as
Begin of row 0
End of row 0
can any one plz let me know the procedures to print first and last row number of a .xls sheet
ans also the column number please.
Similar Messages
-
How to read and write a data from extrenal file
Hi..
How to read and write a data from extrenal file using Pl/sql?
Is it possible from Dyanamic Sql or any other way?
Reagards
Rajuutl_file
Re: How to Create text(dat) file.
Message was edited by:
jeneesh -
How can I Read lines of data from a file starting at the end of the file??
Can anyone help me with how to read lines of data starting from the end of a file instead of the beginning?? I do not want to load the entire file into memory as the files are very rather large. Instead I want to start at the end of the file and read lines backward , until I find the particular data item i am searching for, then stop.
Can this be done in Java ? I know it can be done in Perl.
Thanks.Thanks for your suggestion about the RandomAccessFile, I did actually thought about that approach , but wasn't sure it would work.
I do not want to read the file in a sequential forward manner because the files contain large number of lines of data that have already been processed and therefore there is no need to reprocess these lines of data.
The Unprocessed lines are always at the the end of the file and these are the data lines I am interesting in getting at without having to read the entire file. Therefore, i figure that if I can read the data from the end of the file then this would be much more efficient. -
Hey guys, I'm trying to read a binary data file created by a C++ program that didn't append sizes to the structures that were used when writing out the data. I know the format of the structures and have created a cluster typedef in LabView. However the unflatten from string function expects to see additional bytes of data identifying the size of the cluster in the file. This just plain bites! I need to retrieve this data and have it formatted correctly without doing it manually for each and every single element. Please Help!
Message Edited by AndyP123 on 06-04-2008 11:42 AMSmall update. I have fixed size arrays in the clusters of data in the file and I have been using arrays in my typedefs in LabView and just defining x number of indexes in the arrays and setting them as the default value under Data Operations. LabView may maintain the default values, but it still treats an array as an unknown size data type. This is what causes LabView to expect the cluster size to be appended to the file contents during an unflatten. I can circumvent this in the most simplest of cases by using clusters of the same type of data in LabView to represent a fixed size array in the file. However, I can't go around using clusters of data to represent fixed size arrays BECAUSE I have several multi-dimentional arrays of data in the file. To represent that as a cluster I would have to add a single value for every element to such a cluster and make sure they are lined up sequentially according to every dimension of the array. That gets mighty hairy, mighty fast.
EDIT: Didn't see that other reply before I went and slapped this in here. I'll try that trick and let you know how it works.......
Message Edited by AndyP123 on 06-04-2008 12:11 PM -
How a client could retrieve interested data from log file in dbxml?
I have heard about db_printlog utility in BDB. Is there any similar utility (like shell command or API) in bdbxml?. I want to extract updated nodes from log file.
I got Berkeley DB 4.8.6 and find db_printlog. It works on bdbxml log file . I used it to translate a log file.
I used it with following syntax:
In WinXp Command Prompt:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
D:\Program Files\Oracle\tmp>db_printlog >mylog.txt
D:\Program Files\Oracle\tmp>then mylog.txt created. here is some part of it:
[1][218264]__dbreg_register: rec: 2 txnp 80000017 prevlsn [1][210024]
opcode: 3
name: a.dbxml0
uid: 0xc1 y0 0 0 0 40 0x91 0xed 0xde 0x1d 0 0 0 0 0 0 0 0
fileid: 37
ftype: 0x1
meta_pgno: 22
id: 0x0
[1][218348]__txn_child: rec: 12 txnp 80000015 prevlsn [1][184288]
child: 0x80000017
c_lsn: [1][218264]
[1][218388]__db_addrem: rec: 41 txnp 80000015 prevlsn [1][218348]
opcode: 1
fileid: 35
pgno: 21
indx: 0
nbytes: 8
hdr:
dbt: J3
pagelsn: [1][193024]
and so onBut i couldn't find what i was looking for, i mean the Nodes path. -
Importing Data From XLS File to SQL Server
Dear All,
I want to import the data from Excel(.xls) file to SQL Server (2008 R2). But due to some problem (may be data), an error is occurring when I am going to import using Import Data Wizard. I want the rows to ignore those are creating issues and to keep track
of those records. That's why I need to process rows one by one. How can I do it? Any idea?
Thanks & Regards,
Anujit Karmakar
Anujit Karmakar Sr. Software EngineerWhats the error? Have you mapped the source-destination data types in column mappings?
Below is a link to video to guide you through the Steps of Import/Export Wizard
SSIS Wizard Video: http://www.youtube.com/watch?v=9Wmdhnx1niU
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other
forum members can benefit from it -
Uploading data from xls file to internal table
Hello,
I have an excel file with just one column that has phone numbers. I want to upload these phone numbers into an internal table.
Now my question is: What is the method/function to do this? I tried GUI_UPLOAD but after upload the values in the internal table shows lots of # signs instead of the expected phone numbers.
Regards,
Prafful.Hello Prafful,
If you successed to upload XLS into Internal Table and the only problem you have is a # signs try to the following:
1) instead of the XLS file try to use CSV file (it's a TEXT file - C omma S eperated V alues).
2) Check your Encoding (your FILE Encoding should be a same as GUI_UPLOAD encoding)
Good Luck
Eli Steklov -
Charting data from text file in LabVIEW 5.1 for Windows
I am having some difficulties trying to figure out how to plot a chart with
data from a file. I would like to be able to read data from a text file
into a chart using LabVIEW 5.1 for Windows. I have looked in the help
within the program and online. I have also looked in the user manual and
the book "LabVIEW for Everyone". Could you please give me specific
instructions on how I would construct the program to be able to do this.
Thank you.Hi Ellie,
It depends on how data is stored in that txt file. Usually you load the data into an array either using or , the array if necessary and send it to the graph indicator in required form. If you want a more detailed answer, send me a sample data file ([email protected]). -
BAPI - DATA TRANSFER FROM .XLS FILE TO DB TABLE
I am upload data from xls file to database table.
first i have load xls file data to internal table (it_data) that is working.
then from internal table to database table (zskv_rate) by function module (ZBAPI_RATE_SAVEDATA) which is not working.
ex.
LOOP AT IT_DATA.
Header
ZSKV_RATE-DIVN = IT_DATA-DIVN.
ZSKV_RATE-REGN = IT_DATA-REGN.
ZSKV_RATE-PLANT = IT_DATA-PLANT.
ZSKV_RATE-RATE = IT_DATA-RATE.
APPEND IT_DATA.
CALL FUNCTION 'ZBAPI_RATE_SAVEDATA'
EXPORTING
HEADDATA = ZSKV_RATE
IMPORTING
RETURN = BAPI_RETURN
TABLES
DATA = IT_DATA
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,IT_DATA-DIVN.
ELSEIF BAPI_RETURN-TYPE = 'S'.
WRITE: 'Successfully created material' ,IT_DATA-DIVN.
ELSE.
WRITE:/ 'NONE' ,IT_DATA-DIVN.
ENDIF.
ENDLOOP.
how to transfer data from internal table to database table.Hi Sanjeev,
as u hv uploaded the excel file into the internal table,
u can update the ztable from internal table..
modify <dbtab>from itab.
regards.
Mdi.Deeba -
How to print out the data from the file ?
hi all,
i have upload my file to here :
[http://www.freefilehosting.net/ft-v052010-05-09 ]
anyone can help me to print out the data from the file ?
the content of the file should be like this :
185.56.83.89 156.110.16.1 17 53037 53 72 1
and for the seven column is
srcIP dstIP prot srcPort dstPort octets packetshi all,
i have try to do this
public static void Readbinary() throws Exception
String file = "D:\\05-09.190501+0800";
DataInputStream dis = new DataInputStream(new FileInputStream(file));
//but then how to read the content ??????can you give me more hint ?????
i have find the netflow v5 structure by C
struct NFHeaderV5{
uint16_t version; // flow-export version number
uint16_t count; // number of flow entries
uint32_t sysUptime;
uint32_t unix_secs;
uint32_t unix_nsecs;
uint32_t flow_sequence; // sequence number
uint8_t engine_type; // no VIP = 0, VIP2 = 1
uint8_t engine_id; // VIP2 slot number
uint16_t reserved; // reserved1,2
struct NFV5{
ipv4addr_t srcaddr; // source IP address
ipv4addr_t dstaddr; // destination IP address
ipv4addr_t nexthop; // next hop router's IP address
uint16_t input; // input interface index
uint16_t output; // output interface index
uint32_t pkts; // packets sent in duration
uint32_t bytes; // octets sent in duration
uint32_t first; // SysUptime at start of flow
uint32_t last; // and of last packet of flow
uint16_t srcport; // TCP/UDP source port number or equivalent
uint16_t dstport; // TCP/UDP destination port number or equivalent
uint8_t pad;
uint8_t tcp_flags; // bitwise OR of all TCP flags in flow; 0x10
// for non-TCP flows
uint8_t prot; // IP protocol, e.g., 6=TCP, 17=UDP, ...
uint8_t tos; // IP Type-of-Service
uint16_t src_as; // originating AS of source address
uint16_t dst_as; // originating AS of destination address
uint8_t src_mask; // source address prefix mask bits
uint8_t dst_mask; // destination address prefix mask bits
uint16_t reserved;
but how to translate the structure to java,then get the data from the file ?
Edited by: 903893 on Dec 21, 2011 10:52 PM -
HOW to retrieve PURCHASE ORDER DATA from archieve file and print a report
Dear all
1) I have retrieve purchase order data from archived files.
2) print purchase order data and created pdf file.
VIJ.............
Moderator message - Please ask a specific question - post locked
Edited by: Rob Burbank on Apr 28, 2009 12:00 PMDear all
1) I have retrieve purchase order data from archived files.
2) print purchase order data and created pdf file.
VIJ.............
Moderator message - Please ask a specific question - post locked
Edited by: Rob Burbank on Apr 28, 2009 12:00 PM -
Cant get data from text file to print into Jtable
Instead of doing JDBC i am using text file as database. I cant get data from text file to print into JTable when i click find button. Goal is to find a record and print that record only, but for now i am trying to print all the records. Once i get that i will change my code to search desired record and print it. when i click the find button nothing happens. Can you please take a look at my code, dbTest() method. thanks.
void dbTest() {
DataInputStream dis = null;
String dbRecord = null;
String hold;
try {
File f = new File("customer.txt");
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
Vector dataVector = new Vector();
Vector headVector = new Vector(2);
Vector row = new Vector();
// read the record of the text database
while ( (dbRecord = dis.readLine()) != null) {
StringTokenizer st = new StringTokenizer(dbRecord, ",");
while (st.hasMoreTokens()) {
row.addElement(st.nextToken());
System.out.println("Inside nested loop: " + row);
System.out.println("inside loop: " + row);
dataVector.addElement(row);
System.out.println("outside loop: " + row);
headVector.addElement("Title");
headVector.addElement("Type");
dataTable = new JTable(dataVector, headVector);
dataTableScrollPane.setViewportView(dataTable);
} catch (IOException e) {
// catch io errors from FileInputStream or readLine()
System.out.println("Uh oh, got an IOException error!" + e.getMessage());
} finally {
// if the file opened okay, make sure we close it
if (dis != null) {
try {
dis.close();
} catch (IOException ioe) {
} // end if
} // end finally
} // end dbTestHere's a thread that loads a text file into a JTable:
http://forum.java.sun.com/thread.jsp?forum=57&thread=315172
And my reply in this thread shows how you can use a text file as a simple database:
http://forum.java.sun.com/thread.jsp?forum=31&thread=342380 -
Hi all,
As we can get data from .xls, .xlsx file in a dataset. Now i want to read all the entire data from .xltm file.
I also want to get all sheets name from .xltm file. I am using .Net framework 4.5, Visual studio 2012.
Please help me. I am unable to extract it. It is urgent.Hello Kalpna Bindal,
I just investigate this issue and use the following way but it does work:
private void Button_Click(object sender, RoutedEventArgs e)
// initialize connection
OleDbConnection con = new OleDbConnection();
con.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\Fruits1.xltm;Extended Properties=\"Excel 12.0 Xml;HDR=YES;\"";
//pass query to Insert values into Excel
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = "insert into [Sheet1$] values('')";
cmd.Connection = con;
// EXECUTE QUERY
con.Open();
cmd.ExecuteNonQuery();
con.Close();
I then did a research about this issue and find the following case:
http://stackoverflow.com/questions/22225017/reading-excel-xltm-files-programmatically
To test whether it is possible I use the following code in WPF:
Microsoft.Office.Interop.Excel.Application xltmApp = new Microsoft.Office.Interop.Excel.Application();
xltmApp.Visible = false;
xltmApp.ScreenUpdating = false;
Workbook xltmBook = xltmApp.Workbooks.Open(@"D:\Fruits1.xltm");
Worksheet xlworksheet = xltmBook.Worksheets.get_Item(1);
for (int i = 1; i <= 1; i++)
for(int j=1;j<=1;j++)
string str = (string)(xlworksheet.UsedRange.Cells[i, j] as Microsoft.Office.Interop.Excel.Range).Value;
MessageBox.Show(str);
The result is that I can read this .xltm file and read the firstline without problem.
I would think you can also use this way to work with your .xltm file and output it to your application.
For more details about how to fill to your WPF, common wpf and excel thread will be helpful:
http://www.codearsenal.net/2012/06/c-sharp-read-excel-and-show-in-wpf.html#.URPyfPJJocU
http://www.dotnetcurry.com/showarticle.aspx?ID=988
http://mozouna.com/Blog/2013/03/28/wpf-reading-and-writing-to-excel-file-with-c/
By the way, for WPF case please post on WPF forum instead of C# forum.Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to load the data from excel file into temprory table in Forms 11g?
Hi
How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
Kindly Suggest the Solution.
Regards,
SachinDeclare
v_full_filename varchar2(500);
v_server_path varchar2(2000);
v_separator VARCHAR2(1);
v_filename VARCHAR2(400);
filename VARCHAR2 (100);
v_stop_load varchar2 (2000);
v_rec_error_log varchar2(4000);
v_error_log varchar2(4000);
ctr NUMBER (12);
cols NUMBER (2);
btn number;
RES BOOLEAN;
application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheets ole2.obj_type;
worksheet ole2.obj_type;
cell ole2.obj_type;
cellType ole2.OBJ_TYPE;
args ole2.obj_type;
PROCEDURE olearg
IS
args ole2.obj_type;
BEGIN
args := ole2.create_arglist;
ole2.add_arg (args, ctr);
ole2.add_arg (args, cols);
cell := ole2.get_obj_property (worksheet, 'Cells', args);
ole2.destroy_arglist (args);
END;
BEGIN
v_full_filename := client_get_file_name(directory_name => null
,file_name => null
,file_filter => 'Excel files (*.xls)|*.xls|'
||'Excel files (*.xlsx)|*.xlsx|'
,message => 'Choose Excel file'
,dialog_type => null
,select_file => null
If v_full_filename is not null Then
v_separator := WEBUTIL_CLIENTINFO.Get_file_Separator ;
v_filename := v_separator||v_full_filename ;
:LOAD_FILE_NAME := substr(v_filename,instr(v_filename,v_separator,-1) + 1);
RES := Webutil_File_Transfer.Client_To_AS(v_full_filename,"server_path"||substr(v_filename,instr(v_filename,v_separator,-1) + 1));
--Begin load data from EXCEL
BEGIN
filename := v_server_path||substr(v_filename,instr(v_filename,v_separator,-1) + 1); -- to pick the file
application := ole2.create_obj ('Excel.Application');
ole2.set_property (application, 'Visible', 'false');
workbooks := ole2.get_obj_property (application, 'Workbooks');
args := ole2.create_arglist;
ole2.add_arg (args, filename); -- file path and name
workbook := ole2.get_obj_property(workbooks,'Open',args);
ole2.destroy_arglist (args);
args := ole2.create_arglist;
ole2.add_arg (args, 'Sheet1');
worksheet := ole2.get_obj_property (workbook, 'Worksheets', args);
ole2.destroy_arglist (args);
ctr := 2; --row number
cols := 1; -- column number
go_block('xxx');
FIRST_RECORD;
LOOP
--Column 1 VALUE --------------------------------------------------------------------
olearg;
v_stop_load := ole2.get_char_property (cell, 'Text'); --cell value of the argument
:item1 := v_stop_load;
cols := cols + 1;
--Column 2 VALUE --------------------------------------------------------------------
olearg;
:item2 := ole2.get_char_property (cell, 'Text'); --cell value of the argument
cols := cols + 1;
--<and so on>
ole2.invoke (application, 'Quit');
ole2.RELEASE_OBJ (cell);
ole2.RELEASE_OBJ (worksheet);
ole2.RELEASE_OBJ (worksheets);
ole2.RELEASE_OBJ (workbook);
ole2.RELEASE_OBJ (workbooks);
ole2.RELEASE_OBJ (application);
END;
--End load data from EXCELPlease mark it as answered if you helped. -
HOW TO PRINT THE EXCEL CELL COMMENT IN JAVA SWING FRAME ?
How to print the excel cell comment in java swing frame
user can print the data of cell with comment in bracket in java swing frame.
please make one java code to read an excel spreed sheet and print the output in Java swing frame as follows
EMP NO - 1, 2, 3
EMP NAME - aname (amitesh:very good), bname (amitesh: average), cname (amitesh: very bad)
EMP AGE - 11, 22, 33
EMP DESG - ad, bd, cd
Note: the bracket portion is the excel comments put in that cellhello everyone i'm new to this forum..how are you all...
Jack Brosnan
[mobile phone|http://www.mobilephonesforsale.net.au/apple-iphone-f-2.html]
Maybe you are looking for
-
Iphone 4 Contacts not syncing to Address Book
Hi, I have an Iphone 4 with latest software 4.3 and have been syncing contacts to the address book on my macbook pro via iTunes. It has recently stopped updating any new contacts I add to my phone to the address book. Any help much appreciated.
-
I cant update my iphone 4s to the new update on itunes. When updating it is looking for drivers on my laptop that i do not alredy have so i cannot full update my phone. and it will not come out of the state where it says to connect to itunes on my ph
-
Learning to use flash on a pre-built template.
I am new to flash, and web design at that matter. I am learning to use flash using a pre-built template. Does anyone know how to get the buttons on the template to link to files? Thanks!
-
What is happening to my storage bar?
When I go to "About my Mac" and look to the storage information, it shows that the device has almost 70GB of "Apps" and I don't even have too many apps, it also shows photos and movies, and I don't have any photos or videoclips, just the natives apps
-
Saving Address Book References to a File
In my app, I have built a speed dial-like view very similar to the Phone.app's Favorites list. The user can add new contacts and select which number to call, but I am having issues storing the info to a file so that it can be reloaded after the app i