Read Excel sheet in KM using API.
Hi all,
I kept one Excel sheet (Xsl file) in KM. I want to read that Excel (Xsl) file by using API in NWDS.
How to read ? Is this possible
Helpful answer will be appreciate
Thanks & Regards
Thillai J
Hi Thillai
It is possible to read the files using any of the Java Excel API's ( like POI or JExcel or JDBC-ODBC bridge). It depends on your convenience and requirement as to which one to choose for.
[POI|http://poi.apache.org/] is seem to be widely used.
In your case, the sequence of actions will be as follows:
1. Access the resource and get the content.
2. Get an InputStream from the content object.
3. Next, using this InputStream, the data can be read.
4. Refer to [this|http://www.javabeat.net/articles/41-apache-poi-reading-excel-sheet-using-java-1.html] link as to how read data. (It is assumed that you have successfully retrieved the InputStream in Step 2)
Hope that helps.
Thanks
Deepak
Similar Messages
-
Reading excel sheet from out side of the server though sql developer.
Hi ALL,
Is it possible to read the excel sheet from the out side of the oracle server.
If it possible please send me the sample code.Duplicate thread.
Reading excel sheet from local system though sql developer
Also a FAQ
SQL and PL/SQL FAQ -
Hi,
To achieve these are the steps that I had followed :
1. Add the document Library path into Central Admin -> Application Mgmt -> Manage Service App -> Excel Service App -> Trusted File Locations
2. Add Documnet Library link to Trusted Connection Proivder
3. Open Visual Studio as Run as Administrator
4.Create an SharePoint 2013 Empty Project.
5.Add Service Reference : http:\\<server>\_vti_bin/excelservice.asmx
6.Service added successfully
7.Create a class file and add the Service Reference namespace
There is no such class as ExcelService to call.
Please let me know if somebody knows how to open the Excel file into C#(2012) either using ExcelService or any other way to open. I tried old methods of Sharepoint 2010 server but it's not able to access classes.
Requirement is :
Need to read the excel sheet from Document Library and transfer all data into DataTable.
Please help asap.Hi,
This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the SharePoint 2013 development forum
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/home?forum=sharepointdevelopment
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support -
i use a jexcel to read excel file
i down a package named : jxl.jar
this my code :
public static void readFile() throws BiffException
Workbook w;
try {
w = Workbook.getWorkbook(new File("C:/remon.xsl"));
Sheet read_sheet=w.getSheet("Sheet1");
int cols = read_sheet.getColumns();
int rows = read_sheet.getRows();
Cell cell = null;
for (int j= 1; j < rows; j++) {
for (int i = 1; i < rows; i++) {
cell = read_sheet.getCell(j, i);
catch (IOException e) {
System.out.println("2");
and this the error :
Class jxl.read.biff.BiffException not found in try.
*try {*
*^*
plza help
Edited by: romee on May 13, 2008 2:24 PMI want to read the contents of an MS Excel file from
java, is it possible using JavaBeans-ActiveX bridge or
by any other java technologies, if possible, how ?Bridge2Java from IBM Alphaworks will do the trick for you.
You can get it from here:
http://www.alphaworks.ibm.com/aw.nsf/techs/bridge2java
Using it, you can do things like the following (taken and abbreviated from the samples provided with the package):
import Excel.*;
public class QuickExcel
public static void main(java.lang.String[] args) {
Application app;
Workbooks wbs;
Workbook wb;
Worksheet sheet;
Range rangeA1, rangeA2;
try
com.ibm.bridge2java.OleEnvironment.Initialize();
app = new Application(); // Excel.Application !!! :-)
app.set_Visible(true);
wbs = app.get_Workbooks();
wb = wbs.Add();
sheet = new Worksheet(wb.get_ActiveSheet());
rangeA1 = sheet.get_Range("A1");
String out = new String("This is a test");
rangeA1.set_Value(out);
// Wait five seconds
Thread.sleep(5000);
// Close the workbook without saving
wb.Close(new Boolean("false"));
app.Quit();
} catch (com.ibm.bridge2java.ComException e)
System.out.println( "COM Exception:" );
System.out.println( Long.toHexString((e.getHResult())) );
System.out.println( e.getMessage() );
} catch (Exception e)
System.out.println("message: " + e.getMessage());
} finally
app = null;
com.ibm.bridge2java.OleEnvironment.UnInitialize();
} -
Change Excel sheet tab color using Open XML dll
Hi,
I want to change the sheet tab color of an excel Xlsx document. I am using the following code but it does not set the sheet color. I get object reference exception when I set the sheet tab color.
public static string filepath = @"C:\Test\Book1.xlsx";
private static void ChangeSheetcolor()
try
using (SpreadsheetDocument spreadSheetDocument = SpreadsheetDocument.Open(filepath, false))
WorkbookPart workbookPart = spreadSheetDocument.WorkbookPart;
IEnumerable<Sheet> sheets = spreadSheetDocument.WorkbookPart.Workbook.GetFirstChild<Sheets>().Elements<Sheet>();
//my code
WorksheetPart worksheetPart =
GetWorksheetPartByName(spreadSheetDocument, "Sheet1");
if (worksheetPart != null)
// worksheetPart.Worksheet.SheetProperties.TabColor.Rgb = DocumentFormat.OpenXml.HexBinaryValue.FromString("Red");
worksheetPart.Worksheet.SheetProperties.TabColor.Rgb = DocumentFormat.OpenXml.HexBinaryValue.FromString("#CCCCCC");
// Save the worksheet.
worksheetPart.Worksheet.Save();
catch (Exception ex)
private static WorksheetPart
GetWorksheetPartByName(SpreadsheetDocument document,
string sheetName)
IEnumerable<Sheet> sheets =
document.WorkbookPart.Workbook.GetFirstChild<Sheets>().
Elements<Sheet>().Where(s => s.Name == sheetName);
if (sheets.Count() == 0)
//does not exist
return null;
string relationshipId = sheets.First().Id.Value;
WorksheetPart worksheetPart = (WorksheetPart)
document.WorkbookPart.GetPartById(relationshipId);
return worksheetPart;
How to change the sheet tab color using Open XML dlls.
Thanks
AshokHi J_Prasanna,
I'm afraid that it's not possible with OpenXML SDK, but it's possible if you use Excel PIA along with Internet Explorer. Use the Internet Explorer COM object to render the HTML content, then copy the document, use the Paste method of the Worksheet object
to paste the text with format.
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = False
.Navigate "about:blank"
.document.body.InnerHTML = Sheets("Sheet1").Range("A1").Value
.document.body.createtextrange.execCommand "Copy"
ActiveSheet.Paste Destination:=Sheets("Sheet1").Range("A1")
.Quit
End With
The code is similar if you use managed project.
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 import tablesfrom excel sheet to database using sqldeveloper
hi dear,
i have lots of tables without data in excell sheet. i want to import all the tables in to data base using sql developer .how to import pls help meNo one here is your 'dear' so please don't use such terms.
Whenever you post provide your sql developer version.
>
i have lots of tables without data in excell sheet. i want to import all the tables in to data base using sql developer
>
You will need to provide an example of what you mean by a table without data.
What database and what version. What do you expect to end up with in the database after such an 'import'? -
Reading Excel sheet data in WebDynpro Java Application
Hi,
I need to read an excel file which is stored locally in my computer. How to use upload UI element (in WebDynpro Java) ?
After reading the excel file the data is displayed in table structure in WD Java application. After doing some calculations on click of generate excel button the table data is translated into excel sheet. How to achieve this?
Thanks,
AnmolHi,
Hope the below links helps...
Re: upload & download files
https://wiki.sdn.sap.com/wiki/display/WDJava/Uploading%20excel%20file%20using%20WebDynpro%20for%20Java
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417600)ID0729285250DB01215080400348251106End?blog=/pub/wlg/6603
Thanks,
Prakash -
Applescript to read Excel sheet
Hi All,
I'm a learner of applescript and I have a problem to solve so any help will be very appreciated.
I have thousands of photographies in a folder called "images0". I just want to organize this photos by customer (every customer has its own folder)
I have an Excel sheet with this information: column A: CustomerId / column B: photography name / and column C: name of folder (customer)
How can I read this Excel sheet to make an applescript that automatically move every picture to its correct folder?
Thank you very much to everybody!
AlexHi all
I have reached to create what I asked for by taking examples from internet. I have done it step by step following my needs and for sure there is a better and easy way to do it but it works anyway!
Now I want to create a repeat (loop) for that script but I do not reach to make it work!
I have done the script with this features:
1. Open and filter an Excel file with a given value through a dialog box
2. Select the rows filtered and create a txt file with these content on it (the content are files names)
3. Create a folder with the same name as the given value in step 1
4. Move files from the source folder to the destination folder
Anyone could help me please?
Here you are the script:
property c1 : "A"
property r1 : 1
tell application "Microsoft Excel"
--open workbook workbook file name "Macintosh HD:Users:Alex:Desktop:Libro2.xlsx"
activate object worksheet "Hoja1"
set mycriteria to text returned of (display dialog "Num client" default answer "" buttons {"OK"} default button 1)
autofilter range range "A:B" field "1" criteria1 mycriteria
set {tRow, tCol, lastCell} to {first row index, first column index, last cell} of range object of autofilter object of active sheet
select range (((get address of cell (tRow + 1) of column (tCol + 1))) & ":" & (get address of lastCell))
copy range selection
tell application "Finder"
--set theDestinationFolder to "Macintosh HD:Users:Alex:Desktop" --choose folder
set source_folder to "Macintosh HD:Users:Alex:Desktop:Images:FotoFinder2007:images0" as alias
--make new folder at theDestinationFolder with properties {name:mycriteria as string}
tell application "TextEdit"
open file "Macintosh HD:Users:Alex:Desktop:direcciones.txt"
activate
tell application "System Events"
keystroke "a" using {command down}
keystroke "v" using {command down}
keystroke "s" using {command down}
end tell
tell application "Finder"
set thefoldername to mycriteria
set this_folder to "Macintosh HD:Users:Alex:Desktop:Fotofinder"
set theFolder to (make new folder at this_folder with properties {name:thefoldername})
set source_folder to "Macintosh HD:Users:Alex:Desktop:Images:FotoFinder2007:images0" as alias
set the_files to every paragraph of (read (file "Macintosh HD:Users:Alex:Desktop:direcciones.txt"))
repeat with this_file in the_files
try
move item this_file of source_folder to theFolder --with properties {name:mycriteria as string}
end try
end repeat
end tell
end tell
end tell
end tell
(*set theDestinationFolder to desktop --choose folder
tell application "Finder"
--repeat with theIncrementValue from 1 to 10
make new folder at theDestinationFolder with properties {name:mycriteria as string}
--end repeat
end tell*) -
Data in excel sheet to be used for programing
Hi,
I have to make a z report for which the data i have to use is in a excel sheet.
How can I use this data for making different reports.
Reg,
ArchanaHi,
Try the following code for multiple sheets.
data : $i_intern type kcde_cells occurs 0 with header line.
data : $v_index type i.
data : $v_start_col type i value '1',
$v_start_row type i value '1',
$v_end_col type i value '256',
$v_end_row type i value '7500'.
data: excel_tab type kcde_sender.
data: separator type c.
field-symbols: <field>.
data: application type ole2_object,
workbook type ole2_object,
range type ole2_object,
worksheet type ole2_object,
worksheets type ole2_object,
sheets type ole2_object.
data: h_cell type ole2_object.
data: h_cell1 type ole2_object.
data: l_sheet type c length 40.
data: l_active_sheet type i.
define m_message.
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
end-of-definition.
Create Excel OLE2 object and open XLS file
if application-header = space or application-handle = -1.
create object application 'Excel.Application'.
m_message.
endif.
call method of application 'Workbooks' = workbook.
m_message.
call method of workbook 'Open' exporting #1 = pa_file.
m_message.
Show/don't show XLS
set property of application 'Visible' = 1.
m_message.
Determine number of sheets
call method of application 'Sheets' = sheets.
m_message.
call method of sheets 'Count' = sheetno.
m_message.
l_active_sheet = 0.
do sheetno times.
clear: $i_intern[], excel_tab[].
clear: it_vals[], it_chars[].
l_active_sheet = l_active_sheet + 1.
Activate sheet number L_ACTIVE_SHEET
call method of application 'Worksheets' = worksheets exporting #1 = l_active_sheet.
m_message.
call method of worksheets 'Activate'.
m_message.
Get active sheet
get property of application 'ACTIVESHEET' = worksheet.
m_message.
Find start
call method of worksheet 'Cells' = h_cell
exporting #1 = $v_start_row #2 = $v_start_col.
m_message.
Find end
call method of worksheet 'Cells' = h_cell1
exporting #1 = $v_end_row #2 = $v_end_col.
m_message.
Create range
call method of worksheet 'RANGE' = range
exporting #1 = h_cell #2 = h_cell1.
m_message.
Select range
call method of range 'SELECT'.
m_message.
copy to Clipboard
call method of range 'COPY'.
m_message.
call function 'CONTROL_FLUSH'
exceptions
others = 3.
Import clipboard
call function 'CLPB_IMPORT'
tables
data_tab = excel_tab
exceptions
clpb_error = 1
others = 2.
if sy-subrc <> 0. message x001(kx). endif.
separator = cl_abap_char_utilities=>horizontal_tab.
perform separated_to_intern_convert(saplkcde) tables excel_tab $i_intern
using separator.
set property of application 'CutCopyMode' = 0.
m_message.
enddo.
call method of application 'QUIT'.
m_message.
free object : application,
workbook,
worksheet,
sheets,
range.
m_message.
Hope it works.
Please reward accordingly.
Thanks,
Priyanka -
Reading Excel sheet the corresponding value
the corresponding value of another colum should be read from excel sheet .
soppose there are 4 coloumns and i enter the value of column one then colun 2,3,4 value should be read
Thanks
Sharad.Duplicate post.
-
Help:NoSuchMethodError thrown when reading excel sheet using jxl API
I'm trying to read data from an Excel-2003 sheet using this code:
15. File file = new File("EmpDetails.xls");
16. jxl.Workbook workbook = jxl.Workbook.getWorkbook(file);
17. jxl.Sheet sheet = workbook.getSheet(0);
18. jxl.Cell cell1 = sheet.getCell(0,0);I'm getting this java.lang.NoSuchMethodError: common.Assert.verify(Z)V. The StackTrace is given below:
Exception in thread "main" java.lang.NoSuchMethodError: common.Assert.verify(Z)V
at jxl.read.biff.SSTRecord.getString(SSTRecord.java:417)
at jxl.read.biff.LabelSSTRecord.<init>(LabelSSTRecord.java:56)
at jxl.read.biff.SheetReader.read(SheetReader.java:306)
at jxl.read.biff.SheetImpl.readSheet(SheetImpl.java:611)
at jxl.read.biff.WorkbookParser.getSheet(WorkbookParser.java:204)
at com.scjp.IO.ExcelJXL.main(ExcelJXL.java:17)Please help.Thanks a lot for the reply.
I had both jxl.jar and xlrd.jar in the classpath and xlrd.jar was loaded before jxl.jar.
There is a conflicting common.Assert.class file in xlrd.jar and there is no verify method in it.
That was creating the problem. I loaded the jxl.jar file before the xlrd.jar and it is working fine.
Thanks a lot for the help!!! :) -
Read Excel sheet contents using java/javabeans
I want to read the contents of an MS Excel file from java, is it possible using JavaBeans-ActiveX bridge or by any other java technologies, if possible, how ?
I want to read the contents of an MS Excel file from
java, is it possible using JavaBeans-ActiveX bridge or
by any other java technologies, if possible, how ?Bridge2Java from IBM Alphaworks will do the trick for you.
You can get it from here:
http://www.alphaworks.ibm.com/aw.nsf/techs/bridge2java
Using it, you can do things like the following (taken and abbreviated from the samples provided with the package):
import Excel.*;
public class QuickExcel
public static void main(java.lang.String[] args) {
Application app;
Workbooks wbs;
Workbook wb;
Worksheet sheet;
Range rangeA1, rangeA2;
try
com.ibm.bridge2java.OleEnvironment.Initialize();
app = new Application(); // Excel.Application !!! :-)
app.set_Visible(true);
wbs = app.get_Workbooks();
wb = wbs.Add();
sheet = new Worksheet(wb.get_ActiveSheet());
rangeA1 = sheet.get_Range("A1");
String out = new String("This is a test");
rangeA1.set_Value(out);
// Wait five seconds
Thread.sleep(5000);
// Close the workbook without saving
wb.Close(new Boolean("false"));
app.Quit();
} catch (com.ibm.bridge2java.ComException e)
System.out.println( "COM Exception:" );
System.out.println( Long.toHexString((e.getHResult())) );
System.out.println( e.getMessage() );
} catch (Exception e)
System.out.println("message: " + e.getMessage());
} finally
app = null;
com.ibm.bridge2java.OleEnvironment.UnInitialize();
} -
Change excel sheet name when using spool
Hi, all! I encounter a problem when I was trying to spool a sql to excel using sqlplus.
That is the sheet name is as same as the file name, but the requirement of client is the sheet name is "specific" and not as same as file name, could you please help if there is any solution for this.
thanks a lot for your help.hi
when you create XLS file manually in the command line, can you set the sheet's name?
- no
unless you use some "Basic's" commands to manipulate the file later within your batch file, I think there's no way (excel.exe file provides no options in the command line). -
Access excel sheet uploaded in library on sharepoint using sharepoint development
Hi,
I have an excel sheet which i have uploaded on sharepoint site as a library.
now i want to access this excel sheet using sharepoint development(c#).
Is it possible?
I have one another query- I want to read excel sheet using sharepoint 2010 development.
Please help to solve both issues.
Thanks in advance!
Regards
rajniHi rajni,
According to your description, my understanding is that you want to access the excel files uploaded in a library and read the worksheet data by C#.
You can read excel file using Excel Services. The Excel Services REST API is a new feature of Excel Services that enables you to access Microsoft Excel workbook data by using a uniform resource locator (URL) address. Using the REST API, you can retrieve
resources such as ranges, charts, tables, and PivotTables from workbooks stored on SharePoint Server 2010. More inforamtion, please refer to the link below:
http://msdn.microsoft.com/en-us/library/hh124646(v=office.14).aspx
There are other useful links about accessing and reading excel file in library, please take a look at:
http://www.sharepointwithattitude.com/archives/61
http://www.c-sharpcorner.com/uploadfile/vivekbritish/how-to-downloadread-excel-file-from-sharepoint-library-using-excel-services/
http://stackoverflow.com/questions/14496608/read-excel-file-stored-in-sharepoint-document-library
I hope this helps.
Thanks,
Wendy
Wendy Li
TechNet Community Support -
BDC table control using Excel sheet upload
Hi All,
I am working BDC table control.I want to upload the From excel sheet.I am using the FM ALSM_EXCEL_TO_INTERNAL_TABLE to upload the the data into my internal table.The data is populating in the internal table.
Now i have problem tat how to populate this excel sheet data to the Bdc table control.
Can nybody help me out.\[removed by moderator\]
Thanks,
Swapna.
Edited by: Jan Stallkamp on Jul 25, 2008 10:57 AMafter fetching data from EXCEL sheet, each column data (in excel sheet) will be uploaded to individual record into your internal table along with row number and column number, loop through that internal table and collect all your excel data into record format.pls refer the below code.
data:
i_excel type alsmex_tabline occurs 0 with header line,
l_row type i value 1.
data:
begin of x_data occurs 0,
kunnr like RF02L-KUNNR,
klimk(17) type c,
CTLPC like knkk-CTLPC,
end of x_data,
begin of x_data1 occurs 0,
data(106),
end of x_data1.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_fname
i_begin_col = 1
i_begin_row = 1
i_end_col = no.of columns in your excel file
i_end_row = no.of rows in your file
tables
intern = i_excel.
if sy-subrc = 0.
loop at i_excel.
if l_row <> i_excel-row.
append x_data.
clear x_data.
endif.
case i_excel-col.
when 1.
x_data-kunnr = i_excel-value.
when 2.
x_data-klimk = i_excel-value.
when 3.
x_data-CTLPC = i_excel-value.
endcase.
l_row = i_excel-row.
clear i_excel.
at last.
append x_data.
endat.
endloop.
endif.
then loop through the internal table X_DATA, pass the data to your table control like.
tbl_control-field1(1) = x_data-field1.
tbl_control-field2(1) = x_data-field2.
tbl_control-fieldn(1) = x_data-fieldn.
Regards,
Sreeram.
Maybe you are looking for
-
HP 400 Mouse - How do I change the batteries please?
I've got an HP H2F47AA mouse... Help! how do i change the batteries please?
-
Table for the Purchase Info Record:Text
Dear All As the Purchase Info Record data is saved in the tables like EINA/EINE/EIPA In which table can i find the "Info Record:Text" Please help me guys
-
Update von Photoshop 5.5 auf CS2
Hallo, ich habe noch eine alte Photoshop Version (5.5 Win Full Product D) und würde gerne ein Update kaufen. Nun gibt es im Adobe-Shop die Position "Adobe photoshop CS2 Upgrade (Windows) German" mit dem Hinweis: Um das Upgrade installieren zu können,
-
Calendar events missing after BlackBerry died
About two weeks ago my Tour died a horrible death. I woke up and the web page that I had tried to load the night before was still showing a little clock and the only way I could get out of the browser was to shut the phone off. When I powered it back
-
Can Leopard partition a backup drive with Tiger on it?
I am going to be upgrading tp 10.5.4 on my main HD. I've cloned my whole 10.4.9 system to a 2nd internal drive a while back, but did not create a small partition for a SuperDuper Sandbox at that time. To save myself the time it will take to format th