Excel file currently in use

File is on server
Person 1 running Office XP has an Excel file open.  Person 2 with Office 2007 goes to open excel file. Person 2 receives file in use by Person 1 message.  So Person 2 cancels opening the file.  Goes to Person 1 and says please close file. Person 1 closes file.  Person 2 opens file but is unable to save changes.
"file name.xls' is currently in use. Try again later.
Using Windows Explorer, if you try to delete the file you receive a Cannot delete file name: It is being used by another peron or program.
Close any programs that might e using the file and try again later.
Suggestions?
Michelle

To all of you, you are WAYYYYYYY off base.  It has nothing to do with any of what you are saying.  Although those reasons will all give you the same problem, that is not the cause or the resolution.  The problem is a hidden file ~filename.xls
or whatever the Office program may be.  FYI It took me 10 years to find this fix.  I always knew about this file but never knew it would cause so much pain.  FYI if you've ever lost a file that you need, look for this file.  You can use
it to recover the missing file.  I've used it to save 100s of executives who lost presentations they were working on.
Logon to the server if the file is a network file or the local computer if the file is stored on the local computer.
Go to the Control Panel or open Windows Explorer.
Control Panel – Folder Options
Windows Explorer – Tools then Folder Options.
Go to the View Tab and Select “Show Hidden Files, Folders and Drives”.
Click OK.
Go to the folder that contains the file and look for the file name but with a ~ sign before the name.
Filename.xls = ~Filename.xl
Delete the file with the ~tilde sign i.e.  ~Filename.xls
If the file is on the server you may have to go to the local computer and delete the local file as well.
Have the end user try opening the file again.
You may have to wait 10 minutes before it actually works.
Also, you may have to reboot the server, but you may not have to.
Helpful nice guy

Similar Messages

  • How to upload Excel file in BI using function module in abap program

    How to upload Excel file in BI using function module in abap program?

    Hi Anuj,
    To upload the file , you can try a standard program "RSEPSFTP" .
    while you execute the program , a selection screen appears in which the inputs should be give as
    RFC destination - The target server name
    FTP command- PUT
    local file - your file name
    local directory - path of your local file
    remote file - your target file name
    remote directory - where it has to be stored
    Hope this is useful for you
    Thanks & regards
    Anju

  • How to generate excel file as output using OWB

    Hi,
    I have a requirement to generate an excel file as output using OWB.
    I am trying for a direct approach to create excel files.
    Though I know that excel can be created from a .csv file, I am looking for a direct approach to generate excel file without involving any .csv to excel conversion externally.
    Regards,
    Sri

    so, we are trying to do it by the help of oracle heterogeneous services. In my opinion it is possible (it depends on feature of ODCB Excel driver)
    For more details look at thread (it is about MS SQL Server but maybe it helps)
    Oracle to SQL SERVER
    Regards,
    Oleg

  • Automatically create new Excel file from template using data from a selected row in a separate Excel file

    I am fairly new to Macro and VBA in Excel. I am trying to reduce the amount of work involved in a task that is performed often in our office. Currently, the task involves using 2 separate Excel files. One file is a tracking sheet and the second is the document
    that gets sent out to the client. The second document has all the same information that is inserted into the tracking sheet. What I would like to do is have the information that is in one row on the tracking sheet populate into a new excel file that is created
    automatically from an existing template.
    I have been able to make this partially work. What I have been able to achieve is have the cell that is selected in the tracking sheet (the description field) copy into the new file that is created from the template that is on our server.
    Sub NewRFI()
    ' NewRFI Macro
        MsgBox Selection.Address(ReferenceStyle:=xlA1, _
                               RowAbsolute:=False, ColumnAbsolute:=False)
        Selection.Copy
        Workbooks.Add Template:= _
            "template file path goes here"
        Range("C14").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
        Range("C14").Select
        Application.CutCopyMode = False
    End Sub
    What I need to do is get the rest of the information from that same row in the tracking sheet to copy to the new file as well. The other information includes the document number (one cell to the left of the selected cell), who it is from (one cell to the
    right of the selected cell), and the date (two cells to the right of the selected cell). As stated, this information is all in the same row on the tracking sheet. Each piece of information needs to be copied to a certain cell in the new file and I do not want
    the source formatting to be copied to the new file.
    Ideally, I would like it to operate like so: select the first cell in the row (in this case would be the document number field). Then click a button to run the macro that will then copy the information from that row in the tracking sheet to specific cells
    in the new file that is created from the template.
    This process will save us from having to either manually copy and paste the information into the new file or re-type the same information that is already in the tracking sheet.
    This is probably a simple thing to do but it would be great if anybody had some insight on this issue. Thanks in advance!

    Try code like the following. You will have to change the target cells (D25, F1 and H4) to the ones you want, I just used some arbitrary cells as example.
    Sub NewRFI()
    Dim rngCell As Range
    Set rngCell = ActiveCell
    MsgBox Selection.Address(ReferenceStyle:=xlA1, _
    RowAbsolute:=False, ColumnAbsolute:=False)
    Workbooks.Add Template:="template file path goes here"
    Range("C14").Value = rngCell.Value
    ' Change the target cells as needed
    Range("D25").Value = rngCell.Offset(0, -1).Value
    Range("F1").Value = rngCell.Offset(0, 1).Value
    Range("H4").Value = rngCell.Offset(0, 2).Value
    End Sub
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Opening an Excel file already created - using ADF faces

    I have an action that exports a bunch of data to an excel file using jXLS, which seems to work nicely. However, the file is exported outside of my application context. I would like to open the file right into the file stream so that when they click on the link, it just opens the file directly in the browser or prompts for download.
    Here's my action code. Any suggestions would greatly appreciated.
         public String selectForExcel() throws IOException {
         final String templateFileName = "../server/default/tmp/stats_template.xls";
         final String destFileName = "../server/default/tmp/chart_output.xls";
         Map beans = new HashMap();
    beans.put("platformStats", deviceStats);
    XLSTransformer transformer = new XLSTransformer();
    transformer.transformXLS(templateFileName, beans, destFileName);
    return "success";
         }

    Add the following code to an action that returns null. The action will return the user to the current page and will be presented with a download prompt. This code should work well for your case.
    Regards.
    public static synchronized void downloadFile(String filename, String fileLocation, String mimeType,
    FacesContext facesContext) {
    ExternalContext context = facesContext.getExternalContext();
    String path = context.getInitParameter("externalFiles") + fileLocation;
    String fullFileName = path + filename;
    File file = new File(fullFileName);
    HttpServletResponse response = (HttpServletResponse) context.getResponse();
    response.setHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");
    response.setContentLength((int) file.length());
    response.setContentType(mimeType);
    try {
    FileInputStream in = new FileInputStream(file);
    OutputStream out = response.getOutputStream();
    // Copy the contents of the file to the output stream
    byte[] buf = new byte[1024];
    int count;
    while ((count = in.read(buf)) >= 0) {
    out.write(buf, 0, count);
    in.close();
    out.flush();
    out.close();
    facesContext.responseComplete();
    } catch (IOException ex) {
    System.out.println("Error in downloadFile: " + ex.getMessage());
    ex.printStackTrace();
    }

  • Import Excel file into SQL, using bulk copy - date issues

    Hello. I have a VB project where I need to import multiple excel files with lots of rows and columns into SQL 2012. Currently the import is set up, using OleDbConnection and insert commands and it takes up to 10 minutes to process all the spreadsheets.
    I'm trying to switch the code to use SQLBulkCopy, but experienced issues with dates columns. Some rows have Null dates and those are interpreted as strings and won't import into SQL tables. Is there a way to format the column prior to import programmatically?
    Any advice is appreciated.
    Note -
    If I add column mapping and exclude all dates columns - import works fine. All excel files have date fields, excel files are reports from other vendor and change on weekly bases, manual formatting of the excel files prior to import are out of the question...
    The code is just basic:
    Public Sub ImportFormExcelSample()
    Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MyExcelSpreadsheet.xlsx;Extended Properties=""Excel 12.0 Xml;HDR=Yes""")
    ExcelConnection.Open()
    Dim expr As String = "SELECT * FROM [Sheet1$]"
    Dim objCmdSelect As OleDbCommand = New OleDbCommand(expr, ExcelConnection)
    Dim objDR As OleDbDataReader
    Dim SQLconn As New SqlConnection()
    Dim ConnString As String = "Data Source=MMSQL1;Initial Catalog=DbName; User Id=UserName; Password=password;"
    SQLconn.ConnectionString = ConnString
    SQLconn.Open()
    Using bulkCopy As SqlBulkCopy = New SqlBulkCopy(SQLconn)
    bulkCopy.DestinationTableName = "TableToWriteToInSQLSERVER"
    Try
    objDR = objCmdSelect.ExecuteReader
    bulkCopy.WriteToServer(objDR)
    objDR.Close()
    SQLconn.Close()
    Catch ex As Exception
    MsgBox(ex.ToString)
    End Try
    End Using
    End Sub
    The error I get is System.InvalidOperatiomException: The given value of type String from the data source cannot be converted to type date of the specified target column. System.FormatException: Failed to convert parameter value from String to a DateTime...
    Thank you!
    Alla Sanders

    Hi Alla,
    This issue might be caused because the field contains a NULL value, but the date/time columns in your table does not allow NULL values. Furthermore, please aslo take a look at "Data Type Issues" session in the article below:
    http://odetocode.com/blogs/scott/archive/2013/02/08/working-with-sqlbulkcopy.aspx
    Here is a similar thread about this topic for your reference, please see:
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/2d99181c-fc2b-4caf-9530-3bd6ae1745f1/sqlbulkcopy-column-validation-not-working?forum=sqldataaccess
    If you have any feedback on our support, please click
    here.
    Regards,
    Elvis Long
    TechNet Community Support

  • 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

  • Excel File Error After Using SaveAsDialog in C#

    Hello,
    I have a project where I am trying to use SaveFileDialog. My code runs fine and saves the file to the directory that I choose. The problem is when I try to open the file I receive an error from Excel stating
     “Excel cannot open the file Test_File.xlsx because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file”
     Is there something happening in my code that is corrupting the file during the save process?
    I can’t figure out why I am getting this error. Any help will be greatly appreciated.
    I am working in VS 2013 Pro. and using C#. Here’s my code:
    private
    void btnSave_Click(object
    sender, EventArgs e)
    Stream saveFile;
    SaveFileDialog saveFileDialog1 =
    new
    SaveFileDialog();           
    saveFileDialog1.Title = "Save As";          
    saveFileDialog1.Filter = "Excel Files (*.xlsx)| *.xlsx";
    saveFileDialog1.FilterIndex = 2;
    saveFileDialog1.RestoreDirectory = true;           
    if (saveFileDialog1.ShowDialog() ==
    DialogResult.OK)
    if ((saveFile = saveFileDialog1.OpenFile()) !=
    null)
    // Code to write the stream goes here.
    saveFile.Close();
    Thank you,
    Dave
    David Young

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using ClosedXML.Excel;
    using DocumentFormat.OpenXml;
    using System.IO;
    namespace LoanOrig_FDIC_Codes
    public partial class Form1 : Form
    SqlCommand sqlCmd;
    SqlDataAdapter sqlDA;
    DataSet sqlDS;
    DataTable sqlDT;
    SqlCommand sqlCmdCnt;
    public Form1()
    InitializeComponent();
    //BEGIN BUTTON LOAD CLICK EVENT
    private void btnLoad_Click(object sender, EventArgs e)
    string sqlCon = "Data Source=FS-03246; Initial Catalog=ExtractGenerator; User ID=MyID; Password=MyPW";
    //Set the 2 dateTimePickers to today's date
    DateTime @endDate = End_dateTimePicker.Value.Date;
    DateTime @startDate = Start_dateTimePicker.Value.Date;
    //Validate the values of the 2 dateTimePickers
    if (endDate < startDate)
    MessageBox.Show("End Date must be greater than or equal to the Start Date OR Start Date must be less than or equal to the End Date ", "Incorrect Date Selection",MessageBoxButtons.OK,MessageBoxIcon.Error);
    //Reset both dateTimePickers to todays date
    Start_dateTimePicker.Value = DateTime.Today;
    End_dateTimePicker.Value = DateTime.Today;
    return;
    //End of date validation
    string sqlData = @"SELECT AcctNbr,
    CurrAcctStatCD,
    Org,
    MJAcctTypCD,
    MIAcctTypCD,
    NoteOriginalBalance,
    ContractDate,
    FDICCATCD,
    FDICCATDESC,
    PropType,
    PropTypeDesc
    FROM I_Loans
    WHERE CAST(ContractDate AS datetime) BETWEEN @startdate AND @enddate ORDER BY ContractDate";
    SqlConnection connection = new SqlConnection(sqlCon);
    SqlCommand sqlCmd = new SqlCommand(sqlData, connection);
    sqlCmd.Parameters.AddWithValue("@startDate", startDate);
    sqlCmd.Parameters.AddWithValue("@endDate", endDate);
    sqlDS = new DataSet();
    sqlDA = new SqlDataAdapter(sqlCmd); //SqlAdapter acts as a bridge between the DataSet and SQL Server for retrieving the data
    connection.Open();
    sqlDA.SelectCommand = sqlCmd; //SqlAdapter uses the SelectCommand property to get the SQL statement used to retrieve the records from the table
    sqlDA.Fill(sqlDS, "I_Loans"); //SqlAdapter uses the "Fill" method so that the DataSet will match the data in the SQL table
    sqlDT = sqlDS.Tables["I_Loans"];
    //Code section to get record count
    sqlCmdCnt = connection.CreateCommand();
    sqlCmdCnt.CommandText = "SELECT COUNT(AcctNbr) AS myCnt FROM I_Loans WHERE ContractDate BETWEEN @startDate AND @endDate";
    sqlCmdCnt.Parameters.AddWithValue("@startDate", startDate);
    sqlCmdCnt.Parameters.AddWithValue("@endDate", endDate);
    int recCnt = (int)sqlCmdCnt.ExecuteScalar();
    txtRecCnt.Text = recCnt.ToString();
    btnExport.Enabled = true;
    btnSave.Enabled = true;
    //End of code section for record count
    connection.Close();
    dataGridView1.DataSource = sqlDS.Tables["I_Loans"];
    dataGridView1.ReadOnly = true;
    //Reset both dateTimePickers to todays date
    Start_dateTimePicker.Value = DateTime.Today;
    End_dateTimePicker.Value = DateTime.Today;
    //END BUTTON LOAD CLICK EVENT
    //BEGIN BUTTON EXPORT CLICK EVENT
    private void btnExport_Click(object sender, EventArgs e)
    { //ClosedXML code to export datagrid result set to Excel
    string dirInfo = Path.GetPathRoot(@"\\FS-03250\users\dyoung\LoanOrig_FDIC_Codes");
    if (Directory.Exists(dirInfo))
    var wb = new XLWorkbook();
    var ws = wb.Worksheets.Add(sqlDT);
    ws.Tables.First().ShowAutoFilter = false;
    wb.SaveAs(@"\\FS-03250\users\dyoung\LoanOrig_FDIC_Codes\LoanOrig_FDIC_Codes_" + DateTime.Now.ToString("yyyy-MM-dd") + ".xlsx");
    MessageBox.Show("File has been exported to U:\\LoanOrig_FDIC_Codes", "File Exported", MessageBoxButtons.OK, MessageBoxIcon.Information);
    //End of ClosedXML code
    else
    MessageBox.Show("Drive " + "U:\\Visual Studio Projects\\LoanOrig_FDIC_Codes" + " " + "not found, not accessible, or you may have invalid permissions");
    return;
    //END BUTTON EXPORT CLICK EVENT
    private void Form1_Load(object sender, EventArgs e)
    //Set dates to be today's date when the form is openend
    Start_dateTimePicker.Value = DateTime.Today;
    End_dateTimePicker.Value = DateTime.Today;
    private void Form1_Load_1(object sender, EventArgs e)
    // TODO: This line of code loads data into the 'dataSet1.I_Loans' table. You can move, or remove it, as needed.
    this.i_LoansTableAdapter.Fill(this.dataSet1.I_Loans);
    private void iLoansBindingSource_CurrentChanged(object sender, EventArgs e)
    //BEGIN THE SAVE AS PROCESS
    private void btnSave_Click_1(object sender, EventArgs e)
    Stream saveFile;
    SaveFileDialog saveFileDialog1 = new SaveFileDialog();
    saveFileDialog1.Title = "Save As";
    saveFileDialog1.Filter = "Excel Files (*.xlsx)| *.xlsx";
    saveFileDialog1.FilterIndex = 1;
    saveFileDialog1.RestoreDirectory = true;
    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
    if ((saveFile = saveFileDialog1.OpenFile()) != null)
    // Code to write the stream goes here.
    saveFile.Close();
    private void btnExit_Click(object sender, EventArgs e)
    this.Close();
    //END THE SAVE AS PROCESS
    Here is the code for the whole project up to this point
    David Young

  • MS Office 2007 Excel files pdf conversion using Adobe Acrobat 7.1.0 Professional

    How can I use Adobe Acrobat 7.1.0 Professional to convert EXCEL files (to pdf) from MS Office 2007?

    I don't think Acrobat 7 can recognize Office 2007 files; Acrobat 7 was released way before Office 2007.

  • How do we save three 1D arrays in while loop as an excel file? I used build array, waveform. I could not make it work.

    I have three separate 1 dimensional arrays in a while loop. I need to combine these arrays and save as a excel file outside the loop.
    My second question is that is there any emergency STOP button in Labview so that when I press that button, it cuts all the power going to the system. Thanks...

    Just a comment on the Stop button.
    It's not really a good idea to rely solely on a software emergency shutdown. Especially if the shutdown is to prevent some type of hazardous condition to the people running the test. The problem is that if your application or PC in general is having some type of problem, it may not be able to shut everything down as needed.
    You should always have a mechanical �Big Red Stop Button� that you can hit to cut power to everything. In addition to the button, I usually do have LabVIEW monitor things and if conditions are not looking good, have it automatically shut things down. This has always worked good, and I can�t remember any time I�ve actually had to use the big button, but it�s nice to know it�s there.
    VERY IMPORT
    ANT:
    Using the �Abort� button on the LabVIEW toolbar is NOT the thing to do. This stops your application where ever it is in its execution and does not allow it to finish or execute any shutdown code you might have put in. A �Kill� button on the front panel works well. I�ve put a single Boolean terminal in its own little While loop to monitor it. It usually writes to a digital line that�s holding a relay on that will cut the power.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • Reading heavy excel files page wise using OpenXML

    Hi, 
    I am using OpenXML to read heavy excel files, but I am using paging to read files because I have to process data and show in Grid on frontend. 
    Problem here is for reading every page of 10000 records its time is increasing. 
    First Page = 38397 Milliseconds
    Second Page = 81910 MS
    Third page =117923 MS
    Fourth page =150142 MS
    Any body has any clue...

    Hi,
    >> I am using paging to read files <<
    Are you sure the extra time is used to read the data from Excel files or
    show the data in Grid? If not, I suggest you checking that.
    If the issue is related to reading data from Excel files by Open XML SDK, would you mind sharing some sample code for us to know how you read the files and troubleshoot?
    If the extra time is used for showing data, I suggest you posting in the proper forum based on your developing language for more effective responses.
    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.

  • Converting excel file to PDF using Adobe 9 standard on windows XP

    I have installed office 2010 SP1 on a computer and it already has adobe 9 installed. user never had problem with converting multi sheet excel workbook to PDF using MSoffice 2003.
    Now, when we open excel files in EXCEL 2010 then try to print it to adobe 9, it asks for a filename and we type a name and it convert the first 2 sheet and then it asks again for the other filename and if we enter other name it print other sheets into second file. so basically it splits to 2 PDF files for no reason.
    I tested same file on my laptop with windows 7 and adobe standard 9 and office 2010  and i got same result.
    anybody knows what is the issue?

    Have you updated Acrobat? Have you tried printing to another file format just to see if it is an issue with Acrobat or OFFICE 2010. OFFICE 2010 has forced many folks to upgrade to AA X to obtain compatibility.

  • Excel size becomes large while creating excel file in jsp using content typ

    Hi All,
    I created an excel using jsp by setting content type as excel, the size of the excel is coming nearly around 5MB. If copy the content of that 5MB excel content and paste it and created another excel directly. The size of the new excel is coming around 1 MB.
    It will be great if any body reply me as soon as possible.

    HBhagya wrote:
    I created an excel using jsp by setting content type as excelYou don't create an Excel file that way. You're just fooling the web browser that it is an Excel file so that it will try to use the associated application for that which on its turn is too forgiving that it accepts HTML.
    Look for a Java Excel API to create a real Excel file. Examples: Apache POI HSSF, JExcelAPI, OpenXML4J. Or just use the CSV file format, although you can write it yourself easily, there are API's out as well. Examples: CSV4J, JavaCSV, OpenCSV.

  • Modifying and saving a Excel file by the use of Blob-Stream Method?

    Hi everyone...
    I'm trying to change and modify a Excel file which is received as Blob variable from database.
    I wrote a PL/SQL Procedure which get the Excel file and convert it to blob; after that send it as the parameter of a Java source called TestPrintExcel
    CREATE OR REPLACE DIRECTORY VMI_TEST_DIR AS '/afc/opt/dba/test_utl_dir';
    GRANT READ, WRITE ON DIRECTORY SYS.VMI_TEST_DIR TO SYSTEM;
    declare 
       bfi  bfile := bfilename('VMI_TEST_DIR','TestFzglist.xls');
       bin  blob;
       cout clob;  
    begin
       dbms_lob.open(bfi);
       dbms_lob.createtemporary(bin, true);
       dbms_lob.loadfromfile(bin, bfi, dbms_lob.getlength(bfi));
       dbms_lob.close(bfi);
       dbms_lob.createtemporary(cout, true);
       dbms_java.set_output(100000);
       TestPrintExcel(bin);
       dbms_output.put_line('done!');
    end;With the following Java procedure I can read the content of the Excel file and write it to database perfectly. But the question is, how can i save the excel file with the same way, if i would change or insert any cell? I mean with the same way that to save as blob stream. Because i get permission error when i use another methods like FileOutputStream, FileInputStream etc. That's way i want to resolve this problem with the blob-stream method. Can anybody tell me how i can do that or what a method i have to use?
    Thanks.
    create or replace and compile java source named xltest as
      import org.apache.poi.ss.usermodel.WorkbookFactory;
      import org.apache.poi.ss.usermodel.Workbook;
      import org.apache.poi.ss.usermodel.Sheet;
      import org.apache.poi.ss.usermodel.Row;
      import org.apache.poi.ss.usermodel.Cell;
      import org.apache.poi.ss.util.CellReference;
      import org.apache.poi.ss.usermodel.DataFormatter;
      import org.apache.poi.ss.usermodel.FormulaEvaluator;
      import java.util.*;
      import java.sql.*;
      import oracle.sql.*;
      import oracle.jdbc.driver.*;
      public class XLTEST {
        public static void printx( oracle.sql.BLOB xblin ) throws SQLException {                       
          Connection Conn = null;
          try {
            Conn = DriverManager.getConnection( "jdbc:default:connection:" );
            Workbook wb = WorkbookFactory.create( xblin.getBinaryStream() ); // "/afc/opt/dba/test_utl_dir/TstFzglist.xls"
            for ( int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++ ) {  //NumberOfSheets
              String TableName = new String();       
              switch( sheetNum )
                case 0:
                  TableName = "freeimportxls_s1"; break;           
                case 1:
                  TableName = "FreeImportXLS_S2"; break;
                case 2:
                  TableName = "FreeImportXLS_S3"; break;
                default:
                  break;                  
              Sheet sheet1 = wb.getSheetAt(sheetNum);         
              java.util.Iterator<Row> ri = sheet1.rowIterator();                 
              while ( ri.hasNext() ) {
                Row row = ri.next();
                java.util.Iterator<Cell> ci = row.cellIterator();                       
                while ( ci.hasNext() ) {
                  Cell cell = ci.next();
                  CellReference cellRef = new CellReference( row.getRowNum(), cell.getColumnIndex() );                         
                  switch( cell.getCellType() ) {
                  case Cell.CELL_TYPE_STRING:                            
                    Values   += "'" + cell.getRichStringCellValue().getString() + "'";               
                    break;
                  case Cell.CELL_TYPE_NUMERIC:
                    Values   += "'" + cell.getNumericCellValue() + "'";
                    break;
                  case Cell.CELL_TYPE_BOOLEAN:
                    Values   += "'" + cell.getBooleanCellValue() + "'";
                    break;
                  case Cell.CELL_TYPE_FORMULA:
                    Values   += "'" + cell.getCellFormula() + "'";
                    break;
                  default:
                    Values   += "''";               
                  int Counter1 = cell.getColumnIndex() + 1;
                  int Counter2 = row.getLastCellNum();
                  if ( Counter1==Counter2 ) {
                    Values   += ")";                          
                  else {
                    Values   += "," ;
                } System.out.println ( Values );               
                if ( ( sheetNum >= 0 ) && ( sheetNum <=2 ) ) {
                   String sqlUpdate = "INSERT INTO " + TableName + " VALUES " + Values;
                   PreparedStatement pstmt = Conn.prepareStatement( sqlUpdate );                                          
                   pstmt.executeUpdate();           
                   pstmt.close();              
            } Conn.close();
          } catch ( java.sql.SQLException e ) {       
            System.err.println( e.getMessage() );
            e.printStackTrace( System.err );
            Conn.close();}        
      };

    Hi,
    Because i get permission error when i use another methods like FileOutputStream, FileInputStream etc.Permission errors are generally resolved by granting the proper privilege via DBMS_JAVA.grant_permission procedure.
    Have you already tried that?
    http://download.oracle.com/docs/cd/E11882_01/java.112/e10588/chten.htm#BABHDBCJ

  • Excel File gets Locked using OLE2

    Dear all ,
    We are working with 10g forms
    We are trying to load data from Excel file into a form using OLE2 . We are able to load the data from Excel File .
    Here we try to read the first row of the excel file and verify for a title to be present
    if not present we close the file . we have used the OLE2.Release_OBJ
    declare
    application ole2.obj_type;
    workbooks ole2.obj_type;
    workbook ole2.obj_type;
    worksheet ole2.obj_type;
    cell ole2.obj_type;
    args ole2.list_type;
    Check_file text_io.file_type;
    no_file exception;
    PRAGMA exception_INIT (no_file, -302000);
    cell_value varchar2(2000);
    begin
    Lv_F_File_Type := Text_Io.Fopen(:Cb_Input.Ti_v_File_name,'R');
    application:= ole2.create_obj('Excel.Application');
    workbooks := ole2.get_obj_property(application, 'Workbooks');
    args:= ole2.create_arglist;
    ole2.add_arg(args, :Cb_Input.Ti_v_File_name);
    workbook := ole2.invoke_obj(workbooks, 'Open', args);
    ole2.destroy_arglist(args);
    --Open worksheet Sheet1 of that Workbook
    args:= ole2.create_arglist;
    ole2.add_arg(args, 'Sheet1');
    worksheet := ole2.get_obj_property(workbook, 'Worksheets', args);
    ole2.destroy_arglist(args);
    args:= ole2.create_arglist;
    ole2.add_arg(args, Lv_n_rows);-- lv_n_rows value is 1
    ole2.add_arg(args, 1);
    cell:= ole2.get_obj_property(worksheet, 'Cells', args);
    ole2.destroy_arglist(args);
    cell_value :=ole2.get_char_property(cell, 'Value');
    Lv_v_Title:=cell_value;
    if Upper(Lv_v_Title) <> Upper(Lpk_Var.Lv_v_File_Name_Parameter) then
    Lpk_Alert.Lp_Show('File Title Should be '||Lpk_Var.Lv_v_File_Name_Parameter);
    OLE2.RELEASE_OBJ(cell);
    OLE2.INVOKE(workbook ,'Close');
    OLE2.RELEASE_OBJ(worksheet);
    OLE2.RELEASE_OBJ(workbook);
    OLE2.RELEASE_OBJ(workbooks);
    OLE2.INVOKE(application, 'Quit');
    OLE2.RELEASE_OBJ(application);*/
    end if;
    After this we open the excel , and modify and try to save , it just waits ...
    we are forced to close the form. and then only the excel file gets saved...
    we need to modify the file , when the form is running and then upload the data..
    since the objects are closed , we are unable to understand why the excel file is locked till the session
    Can any one help us
    SSR

    Hi,
    Running on Business Object Enterprise XI 3.1 FP1.5.

Maybe you are looking for