Writing to specific excel cells
Hello,
Is it possible to write to an EXISTING file to one specified cell? I have tried using write to xl.vi as an example, but this rewites the entire file and I lose my old data.
I would greately appreciate any advice!
Thank-you,
Ivanka
Ibahka,
Take a look at the modified example. I show how to open an existing File and sheet. From your post I am not sure if you got that far or not.
Anyways you can then use Set Cell Value.vi SubVI to set the value of an 1 cell in the file and worksheet you just opened.
The example does that in a loop, thus re-writes all the data. However if you only want to set 1 cell, take the VI out of the loop, and use it independantly.
See how I changed the 0,0 cell after all the data is set.
Attachments:
Write_Table_To_XL.llb 156 KB
Similar Messages
-
Text Hyperlink from PDF (converted Word doc) to specific Excel cell in same Portfolio
Good Morning,
I have created a Word document with an embedded Excel sheet (both Office 2007) and created a text hyperlink within the document that points to a specific cell on a specific tab. My company wants to send our document to a customer, but will only send PDFs. When converting to PDF the hyperlink does not work any longer.
To make the behaviour in Word one must open the embedded Excel object to the specific sheet and then copy the specific cell in question. In Word choose Paste as Hyperlink. Press Alt+F9 and then change HYPERLINK to hyperLINK. Press Alt+F9. Edit the Settings of the Hyperlink and change the Text to Display.
Is there a way to do this with Acrobat 10? The plus side would be that the Excel document would not be embedded in Word although it would still need the Document ID of the Excel file in the portfolio. Futhermore, the Word document won't be included in the portfolio.While Acrobat cannot pass opening parameters to non-PDF files it can do so for PDF (under specific circumstances).
See the "Parameters for Opening PDF Files" document at:
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open _parameters_v9.pdf
Be well... -
Export specific Excel cells to Access
Hi,
I'm putting together a submission form in excel which will update a database in access.
I'm currently trying to use a macro on the submit button to do it but and while i understand the majority of it im not sure how to establish the connection through the macro.
Essentially im a VBA n00b and haven't completed a project like this before now.
So i guess my question is how would i go about establishing this through an excel based Macro?
This is my code for submitting the data into Access
rs.Open Sql, cn, adOpenDynamic, adLockOptimistic
With rs
.AddNew
.Fields("Date").Value = Trim(Cells(50, 1).Text)
.Fields("Agent").Value = Trim(Cells(50, 2).Text)
.Fields("Request").Value = Trim(Cells(50, 3).Text)
.Fields("Date1").Value = Trim(Cells(50, 4).Text)
.Fields("Date2").Value = Trim(Cells(50, 5).Text)
.Fields("Start").Value = Trim(Cells(50, 6).Text)
.Fields("End").Value = Format(Cells(50, 7).Value, "hh:mm")
.Fields("RDO").Value = Trim(Cells(50, 8).Text)
.Fields("Call Type").Value = Trim(Cells(50, 9).Text)
.Update
End With
If rs.State = adStateOpen Then rs.Close
If cn.State = adStateOpen Then cn.Close
Set rs = Nothing
Set cn = Nothing
MsgBox "Your request has been submitted." & vbNewLine & vbNewLine & "Thanks...", vbOKOnly, "John Smith"
On Error Resume Next
Call Email
Range("e11:e18").ClearContents
End Sub
But what needs to go before it to establish the connection?
Also how would i find any SQL addresses required for the connection to be made?
Please help!Hello,
Please see the examples on the resources below:
http://msdn.microsoft.com/en-us/library/office/aa195812(v=office.11).aspx
http://www.access-programmers.co.uk/forums/showthread.php?t=199575
I believe the following forum is more appropriate to place your question. If you agree, let me know to move the question to that forum.
http://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
Hi,
How can I read a specific excel cell via Web Dynpro ?
It will be great if someone will provide a short sample of code for that ...
10x in advance
HadarHi Chandran i followed you steps regarding to upload excel sheet data to webdynpro table.
but iam not get clarity how to do this step.
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...
help me onthis step, i need to develop the this feature in application.
you posted like this
Hi
First You have to download the jxl.jar file. You can get this file from the Below site
JExcelApi v2.6.4 (1747kbytes)
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 -
Convert contents of a formatted excel cell to HTML format
Hi All,
Background: I am writing a script that uploads some test cases written in excel into Quality Center. For those who are familiar with the QC Excel Addin, this script would do a pretty similar job except for reducing
the steps involved. I'm using Office 2007 running on Win 7 Pro.
Need: I have a situation where the contents of a formatted excel cell need to be converted to HTML tags representing the same formattin in the excel cell. For example a cell containg the text: "Verify
if help topics in Macro section are
hyperlinked" should be converted to
<html><b>Verify</b> if help topics in <u>Macro section</u> are <i>hyperlinked</i></html>
Question: Is there an inbuilt function in Excel/VBAn accomplish this? Or is a macro required? Any other ideas to accomplish this?
Note: Whatever used for converting (an inbuilt function or a macro) should support new line characters and colors.
Any help or redirection to solutions is appreciated.
Thanks, John.
--Thanks, John Jacob TharakanHere is the function I wrote. This handles the conversion character by character.
Function fnConvert2HTML(myCell As Range) As String
Dim bldTagOn, itlTagOn, ulnTagOn, colTagOn As Boolean
Dim i, chrCount As Integer
Dim chrCol, chrLastCol, htmlTxt As String
bldTagOn = False
itlTagOn = False
ulnTagOn = False
colTagOn = False
chrCol = "NONE"
htmlTxt = "<html>"
chrCount = myCell.Characters.Count
For i = 1 To chrCount
With myCell.Characters(i, 1)
If (.Font.Color) Then
chrCol = fnGetCol(.Font.Color)
If Not colTagOn Then
htmlTxt = htmlTxt & "<font color=#" & chrCol & ">"
colTagOn = True
Else
If chrCol <> chrLastCol Then htmlTxt = htmlTxt & "</font><font color=#" & chrCol & ">"
End If
Else
chrCol = "NONE"
If colTagOn Then
htmlTxt = htmlTxt & "</font>"
colTagOn = False
End If
End If
chrLastCol = chrCol
If .Font.Bold = True Then
If Not bldTagOn Then
htmlTxt = htmlTxt & "<b>"
bldTagOn = True
End If
Else
If bldTagOn Then
htmlTxt = htmlTxt & "</b>"
bldTagOn = False
End If
End If
If .Font.Italic = True Then
If Not itlTagOn Then
htmlTxt = htmlTxt & "<i>"
itlTagOn = True
End If
Else
If itlTagOn Then
htmlTxt = htmlTxt & "</i>"
itlTagOn = False
End If
End If
If .Font.Underline > 0 Then
If Not ulnTagOn Then
htmlTxt = htmlTxt & "<u>"
ulnTagOn = True
End If
Else
If ulnTagOn Then
htmlTxt = htmlTxt & "</u>"
ulnTagOn = False
End If
End If
If (Asc(.Text) = 10) Then
htmlTxt = htmlTxt & "<br>"
Else
htmlTxt = htmlTxt & .Text
End If
End With
Next
If colTagOn Then
htmlTxt = htmlTxt & "</font>"
colTagOn = False
End If
If bldTagOn Then
htmlTxt = htmlTxt & "</b>"
bldTagOn = False
End If
If itlTagOn Then
htmlTxt = htmlTxt & "</i>"
itlTagOn = False
End If
If ulnTagOn Then
htmlTxt = htmlTxt & "</u>"
ulnTagOn = False
End If
htmlTxt = htmlTxt & "</html>"
fnConvert2HTML = htmlTxt
End Function
Function fnGetCol(strCol As String) As String
Dim rVal, gVal, bVal As String
strCol = Right("000000" & Hex(strCol), 6)
bVal = Left(strCol, 2)
gVal = Mid(strCol, 3, 2)
rVal = Right(strCol, 2)
fnGetCol = rVal & gVal & bVal
End Function
--Thanks, John Jacob Tharakan -
Problem in writing into the excel file using java code
Hai ,
I will be getting the data as a string and i am writing into the excel file. the problem is .if it has numeric values even now i will writing as a string data ,at this time i am getting the message in the excel file as "Number in the cell is formatted as text".
I need to remove this thru my code..but i can write only as a string .
To write in a excel file ,i used HSSFWorkbook.just check out
http://www.andykhan.com/ -
How to unfreeze the excel cells
Dear All,
Please i haven a file with freeze cells please i need to unfreeze cells urgently please help.
MS USERHi,
Check out this one "How to Lock or Unlock Excel cells".
For more:
http://office.microsoft.com/en-001/excel-help/lock-or-unlock-specific-areas-of-a-protected-worksheet-HA010096837.aspx
http://office.microsoft.com/en-001/excel-help/unlock-protected-cells-HA102809343.aspx
Note: Improve community discussions by marking the answers helpful.
Thanks
Clark Kent -
SSIS Import Excel Cell Properties
I'd like to use SSIS to import MS Excel Properties - e.g. Color for each cell.
Does anyone have an example of this - values are straightforward, but cell properties are not.
Thank you,
JohnThank you - this is a great start.
The above is a great example using SSIS Script Component - and part of this concept should work. If I use it like it's written I will need about 3600 variables for a 60column by 60 row spreadsheet.
I'm wondering if I can do a loop and If clause to retrieve only those cell references- that specifically meet cell color fill criteria (ie Interior.ColorIndex=7) and put those Cell References either in an array (probably easiest) which can be parsed
later from SQL Server.
This is what I have come up with sans loop/array.
' Microsoft SQL Server Integration Services Script Component
' Write scripts using Microsoft Visual Basic 2008.
' ScriptMain is the entry point class of the script.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _
<CLSCompliant(False)> _
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub PreExecute()
MyBase.PreExecute()
' Add your code here for preprocessing or remove if not needed
End Sub
Public Overrides Sub PostExecute()
MyBase.PostExecute()
' Add your code here for postprocessing or remove if not needed
' You can set read/write variables here, for example:
' Me.Variables.MyIntVar = 100
End Sub
Public Overrides Sub CreateNewOutputRows()
Dim oExcel As Object = CreateObject("Excel.Application")
Dim FileName As String
FileName = Variables.FileName
Dim oBook As Object = oExcel.Workbooks.Open(FileName)
Dim oSheet As Object = oBook.Worksheets(1)
Output0Buffer.AddRow()
' This will take too many rows.
Output0Buffer.Address = oSheet.Range("B4").Interior.ColorIndex
End Sub
End Class
John -
VBA Script Errors on Excel Cell containing a Formula
I'm writing a VBA script. When running the script I have a varible being set from a Excel cell containing a formula. The script errors on this staement. See below
Range("O10").Select
BlockSize = ActiveCell.FormulaR1C1 ' DID Block Size
Cell O10 contains "=VLOOKUP(A1,SP_DID_Range!A:Q,10,FALSE)"
The above formula produces the value 20
What I receive is the formula instead of value the formula produces.
I am trying retrieve the value and use it in another formula. So "BlockSize" should equal 20 not "=VLOOKUP(A1,SP_DID_Range!A:Q,10,FALSE)"If you want the A1-style formula, use the Formula property.
If you want the R1C1-style formula, use the FormulaR1C1 property.
If you want the value, use the Value property:
BlockSize = Range("O10").Value
Note that it isn't necessary to select the cell.
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
Help needed with referencing single Excel cells and formatting resulting text
In InDesign CS5 I am putting together a 20pp catalogue of about 200 products. The plan is to have the product information, SKU code, quantity etc fixed, but have the prices (there are two i.e. pack price and individual price) being linked to an Excel spreadsheet. This is so that the prices can be updated in the Excel file and the InDesign file will pull the new prices through. In case you are wondering why I don't pull the whole set of information through, this is because there are a lot of copywriting changes done to the information once it's in InDesign - it's only going to be the prices that will be updated.
I am planning on having two single cell tables in their own text frame, duly formatted with cell style, table style and paragraph style for the two price variables. This I am then going to have to repeat 200 times making sure I link to the next row down in Excel. This is going to be a hideous task but I see know way of modifying the cell in InDesign to point it to the next row in Excel. That's my first problem.
My second problem is this. In the Excel sheet, the prices are formatted as UK currency and are therefore like this...
£2.00
£0.40
£1.43
£9.99
£0.99
£0.09
What I will require is once I import that data (and refresh the data via a newly saved Excel file) is that the prices end up like this...
£2.00
40p
£1.43
£9.99
99p
9p
So if the value is lower than £1.00 it needs a trailing 'p' added and the leading zero and '£' sign stripped off. If the value is lower than £0.10 it also needs the zero after the decimal point stripping off.
Then formatting wise, the '£' sign needs to be superscripted and the same for the 'p'. This I am assuming could be done via GREP?
In summary, can anyone help with the first task of referecing the Excel cells on a cell by cell basis, given that it is the same cell column each time, but the next row down, and also point me in the right direction of the price formattting issues.
Any help will be gratefully received.I would do this:
Create on line with the formatting.
Export as InDesign tagged text (TXT)
Read out these tags
In Excel exists a function to connect text from several cells and predfined text, there connect the content from cells with the paragraph styling tags. Do it in a seperate sheet. (Better would be to use a database like Access, there you can link your Excel sheet).
Export this sheet as txt file
Place this sheet as tagged text (there is an option in one of the sialog boxes).
In preferences < file handling you can specify that Tablecalculation Sheets and text is not embedded but linked, turn it on. -
How to populate arrayList values in a Excel cell using java
Hi ,
Iam trying to create Excel sheet using java with Apache-POI api's.I need to display values from an arrayList into Excel cell as drop down.kindly suggest me any idea or share any code if u have any.
Thanks in advance
Regards
RajeshI suggest you use google to find examples.
-
Create a check box in excel cell using sap abap
Dear Sap Master's,
Please give me some idea on how to create a check box in excel cell using abap program..
(OLE concept).
Thanks
Moderator message: please search for available information first.
Edited by: Thomas Zloch on Jan 12, 2012select the cell then open the cell formatter:
process should be similar in the iOS version. I do not have any iOS devices with Numbers so I cannot check. I did find this link that may help:
http://support.apple.com/kb/PH3374?viewlocale=en_US -
Create heck box in excel cell using sap
Dear Sap Master's,
Please give me some idea on how to create a check box in excel cell using abap program..
(OLE concept).
Thanks,
Naveen.
Moderator message: please do some research before posting, show what you have done yourself when posting.
Edited by: Thomas Zloch on Jan 17, 2012Not resolved
-
Excel cell border disappears when converting to PDF (continued)
Continuing from http://www.adobeforums.com/webx/.59b4dd40 which was archived already.
I too am getting the problem in which Excel cell borders are disappearing from cells with a background color. Lowering the resolution to 300 dpi does not help.
The borders are definitely disappearing. Printing the worksheet from Excel 2003 prints the cell borders. Printing the worksheet from the resulting PDF does not. I created the PDF using the Create PDF macro that Acrobat 9 adds to Excel.
Here's the really odd thing: it only affects two adjacent cells in the same (first) row of the worksheet. Other cells with the same background color in the same columns or the same row are not affected, nor are the cells in other rows or columns.
Copying similar cells that don't have the problem, then re-converting doesn't help.I just tested inserting a blank row 1 in the spreadsheet, moving the problem cells to C2 and D2, but the borders still disappear from those cells.
Restoring back to C1 and D1, I note that if I copy the cell formats to other worksheets, the problem cells lose their borders on all worksheets.
I then tested what happened if I specified No Color for C1 and D1. The problem transferred to cells G1 and H1, which had then become the first adjacent cells with background color.
Restoring the background color to C1 and D1 transferred the problem back to C1 and D1, and removed the problem from G1 and H1.
Next, I gave cell A1 a background color of white. This removed the problem from cells C1 and D1, and gave it to A1.
Finally, I turned accessibility tagging off and that made the problem go away. However, I need tagging as we must post accessible documents.
So now I have a consistent way to describe the problem: cell borders disappear from the first set of contiguous cells with background colors if tagging is turned on. I'm going to file this as a bug.
Charles "Chas" Belov
SFMTA Webmaster
http://www.sfmta.com/webmaster -
Expand Range referencing an excel cell
Hi,
I am creating an input schedule that should sort with a certain property.
This property is derived from the entity's id eg.. S_Property, I use excel to remove the 'S_' and just return the word 'Property' which is then a property which I filter the account structure.
Is it possible to reference an excel cell, eg =A20 in the memberset part of the expand range?
I do the excel formula to remove the S_ in cell A20, as property="Property", and now I just want to reference cell A20 in the memberset part.
If I reference the cell, all members in my account dimension gets returned. When I physically type in the words then it works fine, but when I reference the cell, then it doesn't work.. Is there another way I can get the value in cell A20 then into the memberset part?
Hope someone can help.
Regards
HenryDear Henry Pieters,
I just give you the information that the memberset cell can refer the certain cell which you mentioned. Please you have to change the format cell of memberset is "General" and the reference cell is "Text". Maybe you can use the Ms.Excel function TEXT( ) or using single quotation mark (').
Thanks,
Wandi Sutandi
Maybe you are looking for
-
How to re-trigger workitem in SAP
Hi All, When employee submitted leave request, it has not gone to correct line manager. We have applied OSS note. Now we have logically deleted work items. Now we would like to re-trigger same workitem. Could you please advice how to re-trigger. Rega
-
ChaRM: transport layer/routes used by ChaRM
Hi! We have very complex trasport system settings and would like to implement ChaRM with parallel usage of transports in non-ChaRM environment. We have a lot of transport routes (between DEV:100 and QAS:100) (e.g. SAP, ZDEV, ZFAD, ZGFA, YDAS). How ca
-
[SOLVED] Huawei E173s-1 mobile broadband dongle not working
Update: check the wiki entry at https://wiki.archlinux.org/index.php/Huawei_E173s Hi, My dongle works out-of-the-box in Ubuntu but I can't get it to work in Arch Linux. I followed the instructions from this site: http://www.vivaolinux.com.br/dica/Mod
-
How to solve it ;(
-
Hi. Up until last week, I could access the multi list realty service (MLS) to look at and search for houses. All of a sudden, I can no longer access/open up photos for particular houses. In other words, the mls site comes up and I can search, but whe