Need to read each sheet of an excel file and pass it to XI
Hi
Actually i need to read each sheet of an excel file and pass it to XI and will create one xml file .I am able to read the excel file by writting a custom module and it is generating the xml output from XI.But my requierment is to read the excel file and create the xml with the sheet name of the excel.suppose sheet name is sheet1, the xml file name will be sheet1.xml.if sheet name is sheet2 the xml file name will be sheet2 and so on....how can i pass this parameter from NWDS to SAP XI s i am passing the string which contains the sheet data.
If I understood correct you are already reading the XLS and creating the XML (not sure if this is a separate executing body out side of XI). Are you using any sort of Object Modal in Java to read the XML? I am aware of Visual Basic object modal for Excel but not sure if one is available in Java from Microsoft.
The Object modal that you are using must be providing an iterator to loop through each of the sheet in the Excel workbook and you should be able to create the XMLs as you desired.
I would be glad to look at you module if you are doing it once the XI file adapter has picked up the excel file.
VJ
Similar Messages
-
Calling each sheet in an excel sheet as csv file in a model
Hi All,
I have an excel sheet as an source having 5 sheets.
So I need to call each sheet in the excel sheet in different models as an csv file.
Thank you in advance.
Regards,
tvmkUsing the normal reverse engineering you should be able to get at the data in the sheets. In the definition of the data model for Excel you can put the "table name" - this might be the Named Range - or it can be the (Excel) "system table" called the same as the Sheet. In English Excel, you get one system table called Sheet1$, Sheet2$...
If you make your resource name a variable, then populate the variable with teh appropriate value before accessing the "table", you should be able to access it dynamically. Then all you need do is write a procedure which reads the Excel system tables to query for the sheet names, and then to iterate through them. -
Is there any way to read the data from an excel file w/o using a loop structure?
I am retrieving a large amount of data (multiple sheets) from an excel file and would like to extract the entire range without retrieving individual cell values(too slow). I can write an range all at once but cannot read it.
If you are able to write a block of data, then you should be able to read a block. The four requirements that you want to verify are:
1. The Range specified must match the exact size and location of the data block you want to read
2. The returned data is in a 2D array of Variants (either strings or numbers)
3. Use Variant to Data to convert to 2D DBL or 2D Strings
4. Check for the correct orientation for your application (use transpose if it is not)
Michael Munroe
Certified LabVIEW Developer
www.abcdef.biz
Michael Munroe, ABCDEF
Certified LabVIEW Developer, MCP
Find and fix bad VI Properties with Property Inspector -
Uploading data from a particular column of a particular sheet from an excel file into internal table
Hi,
I have to upload data in the first coulmn of 7th sheet of an excel file.
Can anyone please help me on this.
This link works perfectly fine for excel files without Macros.
Read multiple sheets of an Excel file into SAP through ABAP - Code Gallery - SCN Wiki
But my excel file has some macros.
And after the macro enable/disable popup is cleared, the system freezes.
Can someone pease help me on this abd tell me an approach different from the one in the above link?Welcome to SCN
Please search before you post next time:BDC, upload data from multi excel sheets -
Reading Each String From a text File
Hello everyone...,
I've a doubt in File...cos am not aware of File.....Could anyone
plz tell me how do i read each String from a text file and store those Strings in each File...For example if a file contains "Java Tchnology forums, File handling in Java"...
The output should be like this... Each file should contains each String....i.e..., Java-File1,Technology-File2...and so on....Plz anyone help meThe Java� Tutorials > Essential Classes: Basic I/O
-
Read a excel file and split its sheets to seperate file ?
Dear all :
How to split a excel file into several file, each have one sheet.my code is as below,thanks:
import org.apache.poi.hssf.usermodel.*;
import java.io.*;
import java.util.*;
import org.apache.poi.poifs.filesystem.*;
public class Extractxls {
public static void main(String[] args) throws Exception
try {
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(args[0]));
HSSFWorkbook wb = new HSSFWorkbook(fs);
int sheetCount = wb.getNumberOfSheets();
System.out.println(sheetCount);
try {
while(sheetCount > 0) {
sheetCount--;
HSSFWorkbook wb1 = new HSSFWorkbook();
HSSFSheet s = wb1.createSheet();
String sheetName = wb.getSheetName(sheetCount);
HSSFSheet sheet = wb.getSheet(sheetName);
// HSSFSheet sheet = wb.getSheetAt(sheetCount);
System.out.println(sheet.toString());
s = sheet;
FileOutputStream fileOut = new FileOutputStream("atest" + sheetCount + ".xls");
wb.write(fileOut);
fileOut.close();
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
} catch (Exception e) { e.toString();}The HSSFWorkbook class is part of the POI project:
http://jakarta.apache.org/poi/
Regards,
Dave Gilbert
JFreeChart Project Leader
I understand poi porject, my problem is that POI can not read a excel file and split its sheets into seperate file (each have one sheet) ?Does any one know how to do it. -
What is the best way to read and manipulate large data in excel files and show them in Sharepoint
Hi ,
I have a large excel file that has 700,000 records in it. The excel file has a few columns that change every day.
What is the best way to read the data form the excel file in fastest and most efficient way.
2 nd Problem,
I have one excel file that has many rows each row contain some data that has certain keywords.
What I want is to segregate the data of rows into respective sheets(tabs ) in the workbook.
for example in rows have following data
1. Alfa
2beta
3 gama
4beta
5gama
6gama
7alfa
in excel
I want there to be 3 tabs now with each of the key words alfa beta and gamma.Hi,
I don't really see any better options for SharePoint. SharePoint use other production called 'Office Web App' to allow users to view/edit Microsoft Office documents (word, excel etc.). But the web version of excel doesn't support that much records as well
as there's size limitations (probably the default max size is 10MB).
Regarding second problem, I think you need some custom solutions (like a SharePoint timer job/webpart ) to read and present data.
However, if you can reduce the excel file records to something near 16k (which is supported rows in web version of excel) then you can use SharePoint Excel service to refresh data automatically in the excel file in SharePoint from some external sources.
Thanks,
Sohel Rana
http://ranaictiu-technicalblog.blogspot.com -
How to read the data from Excel file and Store in XML file using java
Hi All,
I got a problem with Excel file.
My problem is how to read the data from Excel file and Store in XML file using java excel api.
For getting the data from Excel file what are all the steps i need to follow to get the correct result.
Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
Thanks & Regards,
Sreenu,
[email protected],
india,If you want someone to do your work, please have the courtesy to provide payment.
http://www.rentacoder.com -
Read data from Excel file and diaplay in Webdynpro
Hi all,
I need some help. I have a Excel file with set of name, phonenumbers . I want to know how to display the data using Webdynpro. Could some one help me. help is appreciated and I promise to award points for right answer.
Thank you
Maruti<b>Hi
i can explain you to read data from Excel file
First You have to download the jxl.jar file. You can get this file from the Below site
</b><a href="http://www.andykhan.com/jexcelapi/download.html">jexcelapi jar</a>
It will be in Compressed Fromat So Unzip it to get the Contents
After Unzipping The File You will get a Folder (jexcelapi/jxl.jar)
Now in NWDS open web dynpro explorer, Right Click Your Project, a popup menu will appear and in that click Properties
You will get window displaying your Project Properties
On Left Side of the window You Will Find "Java Build Path"
Click That "Java Build Path" and you will get 4 Tabs Showing ( Source,Projects,Libraries,Order and Export)
Click Libraries Tab
You will find options many options buttons
In that click the Button "Add External Jars"
You will get Window in order to fecth the jxl.jar file from the location you had stored
After selecting the jxl.jar i will get displayed and click ok
Now Open Navigator
Open Your Project
You will find Lib folder
Copy the jxl.jar to that lib folder
Note : You cannot Read the Content from the excel file directly
First You Have to copy that file to the Server,
And from the Server you can get the file absolute path
With the absolute path you can read the contents of the Excel file
You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
You have Upload the Excel file from the Server Using the File Upload UI Element
This Coding will extract 3 columns from the Xls File
Coding
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import com.sap.fileupload.wdp.IPrivateFileUpload_View;
import com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource;
public void onActionUpload_File(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_File(ServerEvent)
IPrivateFileUpload_View.IContextElement element1 = wdContext.currentContextElement();
IWDResource resource = element1.getFileResource();
element1.setFileName(resource.getResourceName());
element1.setFileExtension(resource.getResourceType().getFileExtension());
//@@end
public void onActionUpload_File_in_Server(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_File_in_Server(ServerEvent)
InputStream text=null;
int temp=0;
try
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName().toString());
FileOutputStream op = new FileOutputStream(file);
if(wdContext.currentContextElement().getFileResource()!=null)
text=wdContext.currentContextElement().getFileResource().read(false);
while((temp=text.read())!=-1)
op.write(temp);
op.flush();
op.close();
path = file.getAbsolutePath();
wdComponentAPI.getMessageManager().reportSuccess(path);
catch(Exception e)
e.printStackTrace();
//@@end
public void onActionUpload_Data_into_Table(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_Data_into_Table(ServerEvent)
try
Workbook wb =Workbook.getWorkbook(new File(path));
Sheet sh = wb.getSheet(0);
//wdComponentAPI.getMessageManager().reportSuccess("Columns = "+sh.getColumns());
//wdComponentAPI.getMessageManager().reportSuccess("Rows = "+sh.getRows());
int columns = sh.getColumns();
int rows = sh.getRows();
int i=0;
for(int j=1;j<=rows;j++)
ele=wdContext.nodeTable_Data().createTable_DataElement();
Cell c1 = sh.getCell(i,j);
ele.setTab_Name(c1.getContents());
Cell c2 = sh.getCell(i+1,j);
ele.setTab_Degree(c2.getContents());
Cell c3 = sh.getCell(i+2,j);
ele.setTab_Percentage(c3.getContents());
wdContext.nodeTable_Data().addElement(ele);
catch(Exception ex)
wdComponentAPI.getMessageManager().reportSuccess(ex.toString());
//@@end
* The following code section can be used for any Java code that is
* not to be visible to other controllers/views or that contains constructs
* currently not supported directly by Web Dynpro (such as inner classes or
* member variables etc.). </p>
* Note: The content of this section is in no way managed/controlled
* by the Web Dynpro Designtime or the Web Dynpro Runtime.
//@@begin others
String path;
IPrivateFileUpload_View.ITable_DataElement ele;
//@@end
Regards
Chandran S -
Hello Everyone,
I want to store various data but in different sheets of excel file. So how to select Different sheets of same excel file???
Thanks so much
Pallaviaeastet wrote:
Why do you not want to use Active X?
One very good reason that I can think of is that MS keeps changing their ActiveX interface with each version of Excel, so code written for one version of Excel using ActiveX may not work for another version of Excel, even though the basic functionality hasn't changed. A perfect example is when MS changed the "Value" property to "Value2". Yeah, that made a whole lot of sense.
pals wrote:
I dont want to use active X as i am not
getting results... by using write to spreadsheet in am getting results
but on just one sheet... I want different data on different sheets of
same excel file. So....
Can anyone help me in this...
Then it's something you're doing. Please post your code. Have you tried a search on this forum for ActiveX and Excel? There have been tons of posts on it, including lots of examples. There's also the Excel thread. -
How can one read a Excel File and Upload into Table using Pl/SQL Code.
How can one read a Excel File and Upload into Table using Pl/SQL Code.
1. Excel File is on My PC.
2. And I want to write a Stored Procedure or Package to do that.
3. DataBase is on Other Server. Client-Server Environment.
4. I am Using Toad or PlSql developer tool.If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
1. Get your DBA to create directory object in oracle using the following command:
create directory TEST_DIR as ‘directory_path’;
Note: This directory is on the server.
2. Grant read,write on directory directory_object_name to username;
You can find out the directory_object_name value from dba_directories view if you are using the system user account.
3. Logon as the user as mentioned above.
Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
function getData(p_filename in varchar2,
p_filepath in varchar2
) RETURN VARCHAR2 is
input_file utl_file.file_type;
--declare a buffer to read text data
input_buffer varchar2(4000);
begin
--using the UTL_FILE in built package
input_file := utl_file.fopen(p_filepath, p_filename, 'R');
utl_file.get_line(input_file, input_buffer);
--debug
--dbms_output.put_line(input_buffer);
utl_file.fclose(input_file);
--return data
return input_buffer;
end;
Hope this helps. -
FM to get Data from Sheet of an excel file to Internal table??
Hello Champs!!!
I have a problem in Excel File's Data Getting.
There are diffrent Sheets in a single Excel file. I need data of a perticular sheet into an internal Table.
Like there are 2 Sheets in an Excel file EXCEL1, Sheet1 & Sheet2. Both Sheet have diffrent Data in it.
Now i only need Data of Sheet1 of this Excel FIle Excel1.
How can i get it?
Can you please help me in this?
Thanks in Advance!!!!
Girija ShankarWelcome to SCN
Please search before you post next time:BDC, upload data from multi excel sheets -
Read an excel file and convert to a 1-D array of long, 32-bit integer?
My vi right now reads an column of numbers as a 1-D array, but I need to input the numbers manually, and for what I'm trying to do, there could be anywhere between 100 to 500 numbers to input. I want the vi to be able to read the excel file and use that column of numbers for the rest, which the data type is long (32-bit integer).
I have an example vi that is able to get excel values, but the output data type is double (64-bit real).
I need to either be able to convert double(64-bit real) data to long (32-bit integer), or find another way to get the values from the excel file.Just to expand on what GerdW is saying. There are many programs that hold exclusive access to a file. So if a file is opened in Excel, the LabVIEW cannot access the file.
What is the exact error code? Different error codes will point to different issues.
Make sure the csv file is exactly where you think it is and LabVIEW is pointing to the right place. (I'm just going through stupid things I have done)
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Read Excel file and populate in a Table
Hi,
I have a requirement in which i have to read a Excel file and populate it thoroughly in a Table. The rows and column numbers are uncertain.
Help me on this...
Regards,
KrishHi,
I can give solution to Upload Excel file.
1)Add jxl jar folder in the lib folder of ur project.
2)Go to properties of ur project and add jar to ur project.
3)Using the File upload ui ,browse and upload the file.
4)Write the read file in to ur server location using fileoutput stream.
5)then using code u can read the excelfile from the server location itself.
Here is the code:
IWDAttributeInfo attInfo =wdContext.getNodeInfo().getAttribute("upload");
binaryType=IWDModifiableBinaryTypeattInfo.getModifiableSimpleType();
fileuploaded = binaryType.getFileName();
byte b[] = wdContext.currentContextElement().getUpload();
File filename =new File("
<Server name>\<folde name>\" + fileuploaded);
try {
FileOutputStream out = new FileOutputStream(filename);
out.write(b);
out.close();
catch (FileNotFoundException e)
e.printStackTrace();
catch (IOException e)
e.printStackTrace();
int iRows = 0;
try {
Workbook wb = null;
Sheet sheet = null;
wb = Workbook.getWorkbook(filename);
sheet = wb.getSheet(0);
int iColumns = sheet.getColumns();
iRows = sheet.getRows();
int i = 0;
for (int r = 0; r < iRows; r++)
for (int c = 0; c < iColumns; c++)
Cell cell = sheet.getCell(c, r);
characterarray<i> = cell.getContents();
i++;
wb.close();
Declare Globally
//@@begin others
String fileuploaded;
IWDModifiableBinaryType binaryType;
String characterarray[] = new String [10];
//@@end
Thanks,
Durga Rao -
Hi,
a) I want to read EACH VALUE from a spreadsheet file having multiple rows and columns WITH DELAY. I am attaching my VI and sample datalog file for reference (tempsensor.txt).I need to do so because as soon as I read put ON the Sensor button on front panel, LV reads all the values at one go. I need the values for each temperature to be displayed after a delay.
b) Secondly, I would like to read another file containing the state of four antennas (deployed:1; undeployed:0). I am logging state of each antenna in each column of the file(magnet.txt) I need to have four LEDS on front panel to display state of the antennas. I dont know what I have done for antennas in my VI is right or wrong. I guess thats rhe wrong way to approach the problem. Please help!!!(column1: Antenna1 state ; Column2:Antenna2 state.. and so..on..)
Any help would be greatly appreciated!!
Thanks in advance,
Ratnesh
FYI: The first column in my datalog file represents timestamp(number of seconds elapsed), second column: reading for temperature sensor 1, third column: reading for temperature senosr 2, and so on. I am using approx. 11 temperature sensors.
Also, I have generated the log files for the reference purpose only. They do not represent the actual values. They are far away from actual values.
Attachments:
01032005.zip 30 KBLook at this modified version of your VI. After looking at it, I determined that a shift reggister was not required in this case.
Lynn
Attachments:
MultiSensors.2.vi 85 KB
Maybe you are looking for
-
Error in begining a session when using UTF16 mode in OCIEnvNlsCtreate
I wrote this code : OCIEnv* envhp; OCIError* errhp; OCIServer* srvhp; OCISvcCtx* svchp; OCISession* usrhp; envhp = (OCIEnv *) 0; errhp = (OCIError *) 0; srvhp = (OCIServer *) 0; svchp = (OCISvcCtx *) 0; usrhp = (OCISession *) 0; int mode = OCI_DEFAUL
-
dear all, can anyone tell me why a simple snapshot without putting database in backup mode is not efficient? suppose I have taken a snapshot on all database folders and then back them to tape isn't it like the scenario when a power prolbem occurs? th
-
Quarkxpress error code 257 item/content tool is not moving items
OS X 10.9.5 QuarkXpress 9.5.4.0 Problem is error code in Quark when you choose the content tool and try to move an item it does not work. Error code is (Unknown system error Quarkxpress exception 257) This is in the console when starting quark and at
-
Problems getting Lion server down from App store
I have a Mac mini server runing Snowleopard server just fine. Tried upgrading to Lion via the App store - OSX 10.7.4 came down fine - but not the server extension. I end up in a loop where OSX10.7.4 won' install because the server extension is not av
-
I'm an avid online gamer, with my recent game of EVE Online. Recently, I had a small problem with the DSL and was forced to unplug all of my network equipment and computer. Once the "issue" (which turned out to be on there end. Thanks BellSouth!), I'