Close Excel File after getting data from it
Hi!
I have a big vi to make data aquisiton from a spectrometer. I have the aquisition part and the "save to spreeadsheet" part also. Now I want to make a button to open the data from the excel file and show it in a xy chart. I had some problems but now its working except one important thing. After I read the data from the file and have it in the chart, it seems like the file it's not closed cause if I try to open it in excel, it "hangs" the computer. If I stop the vi, there's no problem. What can I do? I saw here in the forum that its not necessary to open or/and close spreedsheet files but i think this problem is because the file it's not "released" or something. Any help would be great.
Here's the part of the vi that reads the file, and the file itself.
Thanks in advance
Strange. I made the attachment. Anyway, here it is:
Attachments:
open data file.vi 17 KB
scan 11h21m17s .xls 44 KB
Similar Messages
-
Uploading Excel File and Reading Data from that File
<b>Hi
Can anyone Please tell me how to upload an Excel File in to the Web Dynpro Application and After that i want to read the data from that uploaded excel file in the Web Dynpro Application to the Web Dynpro table.
Plz help me to solve this.......
Regards
Chandran</b>Hi,
Upload Excel file using File Upload UI
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");
/** get the name of excel file and storing it in the server with the same name and extention****/
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) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
/**Readind from the server**/
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;
//get Cell contents by (COLUMN, ROW);
for (int r = 0; r < iRows; r++) {
for (int c = 0; c < iColumns; c++) {
Cell cell = sheet.getCell(c, r);
characterarray<i> = cell.getContents();
//wdComponentAPI.getMessageManager().reportSuccess("Row"r characterarray<i>);
i++;
wb.close();
Declare Globally
//@@begin others
String fileuploaded;
IWDModifiableBinaryType binaryType;
String characterarray[] = new String[1000];
//@@end
Also look at this blog too /people/perumal.kanthan/blog/2005/03/21/reading-excel-data-from-java-using-hssf-api
Thanks and Regards,
Arun -
Problem in Excel after extracting data from SAP Report
Hello,
I have a problem with Excel file after extracting it from one of the SAP report.
When my client extracted data from SAP in to excel he is coming across minus symbol on both sides of the number.
for ex: -447492177-
When i extracted same SAP report in to excel i didnt face any such problem.
Please share your inputs on what could be the problem.1. Make sure your client and you are using the same version of Microsoft Excel
2. Let your client try to OPEN the exported xls file from a existed workbook instead of double-clicking the file directly.
Atom -
How to get data from an existing Excel file using report generation toolkit
I'm trying to use the Excel Get Data vi from the report generation toolkit, but i can't figure out how to turn a browsable path into the right type for the VI. I've tried using the New Report.vi, but that doesn't work unless you use a template. It won't open an existing excel file and make it an open report to pull data from.
Essentially, i have a bunch of excel files that have data in them and i want to use a VI to analyze the data. So, i'm trying to pull in all the data directly from the excel file so i don't have to reproscess them all into text so i can use the more standard spreadsheet VIs. But to even convert the excel file programtically in labview won't i still need to be able to open the excel file and get the data?
Solved!
Go to Solution.I C.
Got it,
the reason why I can view it using my Excel file because its in .CSV.
I open Microsoft Excel to open .CSV file.
But you can also open .csv file with notepad.
So, you cannot open .xls with Read Spreadsheet File
I learn something everyday
Best regards,
Krispiekream -
Problem: this mac is not reading an excell file after upgrading to yosemite. My Mac is from 2009, it use to work perfectly but it wasn´t able to open some apps, thats why i upgrade it. Now it once i donwload the zip it appears with an ".ods" extension
i even already download a link
http://www.microsoft.com/en-us/download/confirmation.aspx?id=44026
which i read on another support page... but it doesnt allowed me to install it cause it says that i already have the disk of this program....
Im afraid to erase it and not being able to get it back...
What can i do!??
Thanks in advance for this kind answer!!!fsolution wrote:
Problem: this mac is not reading an excell file after upgrading to yosemite... Now it once i donwload the zip it appears with an ".ods" extension...
If the "it" refers to a compressed (zipped) spreadsheet that you downloaded, the ".ods" extension is used by LibreOffice and probably OpenOffice (which are free versions of MS Office) for spreadsheets, which would suggest that wherever you're getting that "Excel" file from has switched to one of those programs. I've tried opening an .ods file from LibreOffice using MS Office 2013 for Windows and it does open though with a warning that some things have been changed. I don't know if Office for Mac can normally open .ods files. But if your need is to just open .ods files, take a look at LibreOffice. -
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 -
How to get data from a file?
Hello everyone, i'm new to this forum and to java too. Ok, so here is what i want to do:
I want to get data from a file containing words and numbers and store them into variables that i will use them after to insert into a database table. For example i have a file called employees.txt in this form:
eid ename zipcode Hire_date
1000 "Jones" 67226 "12-DEC-95"
In C++ i declare variables for each data and store them, for example in this case:
ifstream in("somefile");
string name, hdate;
int eid, zip;
in >> eid >> ename >> zip >> hdate;
So i want to do the same thing in JAVA but i can't make it work. So, i would appreciate if someone could give me a simple example how to do it. Thank you.[http://java.sun.com/docs/books/tutorial/essential/io/index.html]
-
Create excel file in document library from the data in datatable
Hi ,
I want to generate files dynamically and have then saved to my documetn library instead of some location on the harddisk.
I want to generate and excel file which will read data from the sharepoint list.
Form that data excel will be genereated in the code ,and i want the generated excel directly available in the document library.
I could use open xml of excel itneroperablity for the excel file generation.
How can i do that.Hi,
According to your description, you might want to gather data from a SharePoint list as an excel file and upload it to a Document Library.
As you said, you can generate an Excel file using the Open XML SDK, I will provide some information about how to get data from SharePoint list and how to upload files
to a Document Library.
About the retrieving data from a SharePoint list, we can use SharePoint Object Model:
SharePoint Object Model -
SPListItem class
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.aspx
Add, Update and Delete List Items Programmatically in SharePoint
http://www.mindfiresolutions.com/Add-Update-and-Delete-List-Items-Programmatically-in-Sharepoint-372.php
About
How to: Upload a File to a SharePoint Site from a Local Folder:
https://msdn.microsoft.com/en-us/library/office/ms454491(v=office.14).aspx
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
contact [email protected]
Patrick Liang
TechNet Community Support -
Cannot Open Excel File after exporting from Disco Plus
Hi there,
I got a question from one user having issue with opening Excel file after exporting from Disco Plus.
The report has been using for a while and he is using Excel 2003 version and Discoverer 10g(10.1.2.2), he never got this kind of error before, just recently got error.
After exporting from Disco Plus he saved file on his desktop and when he tries to open the excel it says "Cannot be Accessed, can be corrupted...." but this is not from network drive since he saved file on local desktop or C drive.
Also not for all reports, only this particular report and only specific parameter, for example for parameter 2008 Feb opened successfully, but for2009 Feb he gets this error when trying to open excel.
i tried in excel 2007 also , i dont think this is Excel version error, am not sure.
Also after go live last week (we upgraded database from 9i to 10g) but i am not sure this causes ,since for one parameter working, for other parameter not working.
Actually we should get one window for Macro when we try to open excel, but he is not getting it seems.
Any ideas/thoughts on this would be greatly appreciated.
Thanks for your help
--skatRod,
Thanks for your quick response on this.
Yes, we can export to other formats as well, but actually exporting is working, after saving the file on our local desktop/drive and when we try to open we get this kind messages or we cannot open the file, we should get message window for Macro to enable/disable but for this report we are not getting this either,
Also this happens only for specific parameters,like i mentioned above it works I mean excel file opens for one set of parameters but for some other set of parameters cannot open.
For example :- when we enter FEB 2008 it works, if we enter FEB 2009 it won't open the file.
This is weird
I am still working on this issue, may be better to recreate the report again might be helpful,
Any ideas/comments/thoughts would be great
Thanks
Skat -
Get data from file in server to client and vice versa
after greeting
i really didn't know how to use socket and serversocket to get data from file in the server and display it to client.
also read file from client and save it to server.
really i didn't know how to do it.
really i want the reply as soon as possibleYou REALLY need to work through the Java networking tutorials:
http://java.sun.com/docs/books/tutorial/networking/index.html -
After migrating data from Time Machine, some of my photos are not showing up in iPhoto LIbrary view. I get a 'dashed rectangle." When I click on it I get ' ! in a Triangle" When I click on that, I actually can see the photo. I want to see all my photos in 'Library' view, and I can't figure out how these photos seem to be arbitrarily hidden. Help, please.
Try these for the first attempt:
First be sure to have a backup copy of the library if you already don't have one.
OT -
Sending and getting data from external file.
I'm running it in actionscript 1 and 2 since 3 wouldn't work when getting data from external media. I'm trying to find out how to post data to a PHP file and getting from that file I'm trying to make the flash for something that works like a game but differently. Since I just found out how to make the HTML stuff show up but a lot of times, some of my text will not appear so I don't know what's going on.
Does anyone know how to send and get data both at the same time from a sample file?
The sample file is example.php
It has to sent information like ID and NAME
and it has to get information like Description and userIDNed Murphy wrote:
The tutorial I pointed you to does provide the visuals you requested, both the AS code and sample PHP code, so I can't see where your learning by visuals aspect holds up.... your approach sounds more like you want someone to hand you a tailored solution that you won't need to learn from. Visuals require reading and doing. If that fails to get absorbed or you couldn't understand/revise it, what could anyone else prepare for you that would work better?
I did the tutorial and everything but every time I press the button or even load it, it keeps on saying undefined. I like the have a sample FLA file so I can figure things out. I did everything from the site but it won't work out for me.
I did step 5 too because it was almost all that I was looking for but it won't even work. keeps on saying undefined. I would show you but webcam max won't work and I can't show you an example.
EDIT:
You know it's frustrating when I don't know how the heck I'm supposed to do this stuff. I read the whole dang thing and I still can't get this dang thing working.
I did everything. EVERYTHING. I just don't get this crap. -
Is that possible to get data from the red trace in this BMP file
I have an instrument, which only export image file. I want use labview to replot it and do some analysis. The image file is like attachment. Is that possible to get data from the red trace in this BMP file via labview vis?
Attachments:
coax312.bmp 4741 KBI looks to me that 515 pixels represents 200 meters, so multiply the
x-values by 0.3885 meters/pixel to get the true x-values. I don't
have enough information to scale the y-axis.
Randall Pursley
Attachments:
Compute from BMP.vi 66 KB -
hi all
i am trying to get data from socket www.yahoo.com site and try to write in file with following code
NOTE:here netClient is the soccket object accepted by server
File f=new File(finalpath);
BufferedReader fromClient = new BufferedReader(new InputStreamReader(netClient.getInputStream()));
OutputStream fo=new FileOutputStream(f);
String str;
try{
while((str=fromClient.readLine())!=null){
byte buf[]=str.getBytes();
fo.write(buf);
}catch(Exception e){}
finally{fo.close();}
But i am not getiing data from socket
please help
regards krunalGeneralYerevan is absolutely right. Use URLConnection and you will get what you want. It seems to me that you do not know deeply how http works. The fact that you opened a connection to www.google.com doesn't mean that you will get data. The web server, after it accepts the socket object, waits for your request. In you case it is something like "GET / HTTP1.1", which you have to write to the stream. URLConnection does all this for you and all you have is to read the InputStream.
-
Excel file is not deleting from server
Hello expert,
I am creating excel file using jxl and in that file i am inserting table data. now the problem is that file is not deleting from the server.please give some suggestion so that i can delete from server .
Thanks and Regards
Kumar Rakesh.
IWDCachedWebResource cachedExcelResource = null;
try
String date = DateConvert(new Date(System.currentTimeMillis()).toString());
String user_ex_form= wdContext.currentContextElement().getUser_excel_cfrom();
String fileName = "CFormStatus"dateuser_ex_form+".xls";
File f = new File(fileName);
WritableWorkbook workbook = Workbook.createWorkbook(f);
WritableFont red = new WritableFont(WritableFont.ARIAL, WritableFont.DEFAULT_POINT_SIZE, WritableFont.NO_BOLD, false, UnderlineStyle.SINGLE, Colour.RED);
WritableCellFormat redFormat = new WritableCellFormat(red);
WritableFont blue = new WritableFont(WritableFont.ARIAL, WritableFont.DEFAULT_POINT_SIZE, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLUE);
WritableCellFormat blueFormat = new WritableCellFormat(blue);
WritableSheet sheet = workbook.createSheet("C Form Status", 0);
workbook.setColourRGB(Colour.LIME, 0xff, 0, 0);
workbook.write();
FileInputStream excelCSVFile = new FileInputStream(f);
cachedExcelResource =getCachedWebResource(excelCSVFile,fileName,
WDWebResourceType.getWebResourceType("xls","application/ms-excel"));
wdContext.currentContextElement().setRESOURCE(cachedExcelResource);
workbook.close();
f.delete();Hi,
I just worked on same functionality where i used a button to create excel file with context data and save in local system.
Use the following code under a button, So on click of button you can directly get the excel file saved in to your desktop without saving on the server
String ordcaeno="000"sysdate".XLS";
String str = "";
for(int j = 0; j< wdContext.nodeZflash_File().size(); j++)
str =str"\n" wdContext.node<<ABC_File().getABC_FileElementAt(j).getRecord();
try
IWDCachedWebResource resource = WDWebResource.getWebResource
str.getBytes("UTF-8"), WDWebResourceType.UNKNOWN
resource.setResourceName(ordcaeno);
IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal()),
resource.getResourceName());
window.show();
catch(Exception ex)
wdComponentAPI.getMessageManager().reportException( new WDNonFatalException(ex), false );
Regards
Raghu
Maybe you are looking for
-
Hi I am doing my file to file scenario. after completing what are the test cases we check in sender file adapter and receiver file adapter? regards venkat.
-
Can't view pdf files on safari
Hello, everyone! I am having the following problem with safari: For around 2 months it has stopped displaying pdf files. Whenever I press a pdf link a blank (dark grey) screen opens showing absolutely nothing. I cannot download a pdf, view it or save
-
Can't Stay Signed on to My.Yahoo
Recently, on my iMac running Safari beta 4 I cannot stay signed to my.yahoo page. I checked the box to stay signed on for two weeks. I have cleared the cache and deleted all cookies to no avail. It used to stay signed on. Safari on my iPhone and PC a
-
Iv had my ipod for few years.. now the sound through the headphone is muffled i brought new ones but the sound is still the same.. does the headphne jack need changing and how much will it cost ?
-
Delivery quantity changed while delivery was being picked .
Hi Friends . I have a big problem, because the delivery quantity changes while the delivery was being picked. This is the positively the 3rd time that we have seen this, possibly the 4th, recently. Delivery was created this morning for 800pc. Batch