Update pivot table cell then refresh

 I want to update my pivot table that connects to my SQL2008R2 AS. The requirement is to update the ship date with cuurent date then refresh
all Tabs with WorkBook. Here is my code that doesn't allow me to update the cell. The xcel version is 2003.
$year=(Get-Date).Year
$month="{0:dd-MMM}" -f (Get-Date)
$sdate="{0:yyyy-MM-dd}" -f (Get-Date)
# Create base object
$xl = new-object -comobject Excel.Application
# make Excel visible
#$xl.visible = $true
$xl.DisplayAlerts = $False
# open a workbook
$wb = $xl.workbooks.open("C:\archive\ShipmentDetailEur.v4.xls")
# Get sheet1
$ws = $wb.worksheets | where {$_.name -eq "CustShipmentDetail"}
$sdate=[char]39 + "{0:yyyy-MM-dd}" -f (Get-Date) # '2012-08-30
$ws.Cells.Item(11,2) = $sdate
$wb.Save()
#logging stuff
Write-Host $wb.Name
write-host $wb.Path
$xl.Quit()
  Error:
Exception setting "Item": "You cannot select an item in this field
 Thanks.
    

Hi Hart60,
I could not reproduce the error you posted, however, To update the item in the Excel cell, please refer to the script:
$ExcelPath = 'd:\merge3.xlsx'
$Excel = New-Object -ComObject Excel.Application
$Excel.Visible = $true
$ExcelWordBook = $Excel.Workbooks.Open($ExcelPath)
$ExcelWorkSheet = $Excel.WorkSheets.item("CustShipmentDetail")
$ExcelWorkSheet.Cells.Item(2,1).Value2 = "teststring"
$ExcelWorkSheet.SaveAs("d:\merge3.xlsx")
## quit the workbook
$Excel.Quit()
For more detailed information, please go through this article:
Modifying Excel Documents with PowerShell
If there is anything else regarding this matter, please feel free to let me know.
Best Regards,
Anna Wang

Similar Messages

  • Excel 2010 Pivot Table VBA Not Refreshing Table

    My company recently upgraded from Excel 2003 to 2010. I had VBA written to take source data and convert it into a number of Pivot Tables on a number of worksheets. It has been working fine for years. After upgrading to 2010 the VBA crashed. I tracked it
    down to the fact that when my code was making changes to the Pivot Tables (changing fields, filters, etc...) the pivot table on the worksheet had no data, but the fields were there. I can manually go to the pivot table and manually refresh and all the data
    comes in.
    So I tried adding the VBA code to refresh the pivot table, but the pivot tables will not refresh with data.
    I tried:
    ActiveSheet.PivotTables("WO Pivot").RefreshTable
    and
    ActiveWorkbook.RefreshAll
    And these did not work.
    I also tried recording a macro for the manual steps to refresh and got:
     ActiveSheet.PivotTables("WO Pivot").PivotCache.Refresh
    This does not work either.
    The PivotTable name is correct, but I tried using the number as well, and the name works for other code manipulating the the pivot table.
    e.g.:
    With ActiveSheet.PivotTables("WOPivot").PivotFields("Task Title")
          .Orientation = xlRowField .Position = 2
          .Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _False, False)
    End
    With Why isn't this working? Is there another way to refresh pivot table data in 2010?
    Thanks. P.S. I've tried formating this so it is readable, but it comes out garbled. Hope this looks better.

    The solution above didn't work for me, but the following did the trick:
    ActiveSheet.PivotTables("WOPivot").PivotCache.Refresh
    By the way, I identified it by recording a macro, then going on the Pivot Table that needed refreshing and pressing F9 to refresh it. The line of VBA code above was the result.
    Cheers,
    Marco.

  • Problem trying to update a table cell

    Hello all,
    I'm trying to implement a setValueAt method using an arrayList.....no success. Could anyone help?
    When trying to change the a value in the table I get these errors:
    "Exception occurred during event dispatching:
    java.lang.ClassCastException: java.lang.String
    at CachingResultSetTableModel.getValueAt(CachingResultSetTableModel.java:37)
    at javax.swing.JTable.getValueAt(JTable.java:1711)
    at javax.swing.JTable.prepareRenderer(JTable.java:3530)"
    public void setValueAt(Object avalue, int r, int c){
    if(r < cache.size()){
    row[c] = (Object[])cache.set(r, avalue);
    fireTableCellUpdated(r, c);
    }//setValueAt
    *********For reference here's the getValueAt method*************************
    public Object getValueAt(int r, int c){
    if(r < cache.size()){
    row = (Object[])cache.get(r);
    return row[c];
    else
    return null;
    }//getValueAt

    Hello,
    I am new at implementing this a table model and JTable, so all I am working with is the mainApp, the model, and the JTable. I am not too sure if and what listeners I should setup.
    I can compile the program. After the data is presented in the table, I try to change a value in one of the cells. Once I have clicked out of the cell I get the ClassCastException: java.lang.String error. I believe the exception is being created by the data I am entering. Do you know of any links that could help me figure how to properly update a cell.
    Determen

  • How to run update query statement to update a table cell

    I have a job within that has dataflow which loads data to target after teh dataflow is done loading, i would like to call to run the following: in the workflow context do i need to add a script object , plus also the below query is it the proper way to run an update statement.
    sql('Target_DS','update tbl_job_status set endtime=sysdate() where endtime is null');
    Thank you very much for the helpful info
    kind regards.

    Arun,
    Is this the right way instead of doing enable recovery.
    Manaully taking care of recoverable workflow logic, by updating a table_job_status(starttime and end_time columns)?
    the only advantage of going this way rather than using recover as a unit is, if i use recover as a unit.
    then if any problem occurs in any dataflow, then all the dataflow one more time gets executed.
    instead i want only the data flow with the error occur has to run. for delta's.
    Kind regards.
    Edited by: cplusplus1 on Feb 13, 2012 4:21 PM

  • Updating model for pivot table in af:iterator

    Using Master Detail relationship, i am trying to create multiple forms at runtime. I want to show all the forms at once. Each form has some header fields and a pivot table. Header field is coming from master table and pivot table should be made from child.
    I am using af:iterator to iterate over master table rows and show header:
    <af:iterator id="i1"
                value="#{bindings.MasterTableVO.collectionModel}" var="row"
                varStatus="index"> For pivot table, i dragged Child View Object from Data Controls to make pivot table.
    <dvt:pivotTable id="pivotTable1"
              value="#{bindings.ChildTableVO.pivotTableModel}"
              summary="pivot table" sizing="auto"
              pivotEnabled="false" drillingEnabled="false"/>                                    Now while iterating, i am not able to get updated model for pivot table. Values from Master table are being updated, but pivot table from child table showing details corresponding to the first row of master table everywhere.
    So can you please help me, how to get the updated pivot table model corresponding to the current row in parent iterator ?
    I am using JDeveloper 11.1.1.6.0
    Thank You.
    VS

    Hi Aswini ,
    I didnot worked for me. I need to change the usecase a bit..
    however you can eaisly display the af:table inside iterator in readonly mode, but when you perform crud operations inline then it gives problems..
    Can you explain your usecase.
    Regards,
    Santosh.

  • Pivot tables causing problems in Excel 2013

    I have a couple of issues I have been able to replicate on multiple machines (all running Office 2013 either as standard or as part of a 365 sub. 3 running W7 and one on W8.1)
    Whenever I load certain sheets with pivot tables, I can refresh data on them and that all works OK, but if I show the "Field List" bar on the right, Excel grinds to a halt and will not accept any input. Another, possibly related, issue is on some
    (not on all the ones with the first issue though) I use freeze panes. When refreshing the ones with this active, the screen flashes rather a lot and only stops when I turn off Freeze Panes.
    Have tried various fixes such as setting Windows to "Best Performance", disabling Hardware Acceleration in Excel, disabling addins (it does the same things using /safe) and recreating the file from scratch (this works the first time I use it, but
    then if it gets opened in 2007 Excel, then opened again in 2013, the issue comes back again), disabling animations with a registry tweak and renaming the OSF.dll file.
    Have checked and am running latest update of Office 2013 (currently 15.0.4675.1002).

    Hi,
    Based on the issue description, the problem occurs when setting a print area. Are you using the same printer with the multiple PCs? I notice this issue has reproduced on multiple machines. I'm wondering whether the printer driver caused the
    crash issue. I recommend we update the printer driver to test.
    Then, the crash can be caused by various factors, such as anti-virus programs, other programs that conflicts with Excel. If the problem persists after updating the printer driver, I suggest you perform a selective startup to determine whether
    a program, process, or service conflicts with Excel, please refer to Method 8 in this kb below:
    http://support.microsoft.com/kb/2758592/en-us
    Other methods in this kb are also suggested to troubleshoot the problem.
    If this issue still exists, please collect the Event log and app crash dump file to do further troubleshooting.
    (You also could send them to me. Email address:[email protected] )
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Is it possible to change the data of Pivot Table?

    Hello,
    I want to develop an excel add-in in .net and want to show the data to user using "Pivot Table".
    Is there a way in which I can allow the user to change the cell values of the "Pivot Table" without changing the source data?
    Any guidance is highly appreciated.
    Thanks!
    -Vinay Pugalia
    If a post answers your question, please click "Mark As Answer" on that post or
    "Vote as Helpful".
    Web : Inkey Solutions
    Blog : My Blog
    Email : Vinay Pugalia

    Hi Vinay,
    As far as I know, it's not possible. We can only change those Pivot Table cells that belong to Row Label or Column Label. But we can't change the Value cells. You'll get some errors like "Cannot change this part of a Pivot Table report".
    If you just want to display a report with some changes to the original Pivot Table report, I would recommend that you copy the data from the Pivot Table to another worksheet, then modify the values.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to hide/suppress empty columns in pivot tables

    In a pivot table, is there any way to do something like "suppress missing data" to make an entire column hidden only if it is empty? I have a situation where I can't hide an entire measure because the measure has values for another dimension, but I would like to hide the column that is empty. See the example below. I would like to hide the combination of Dim1 and Measure 2, and the combination of Dim 2 and Measure 3. I can't hide all columns with Dim1 and/or Dim2, or Measure2 and/or Measure3. Is there any way to hide just the column with the empty combination? Thanks.
    Dim1 Measure1 Always populated
    Dim2 Measure1 Always populated
    Dim1 Measure2 Always null
    Dim2 Measure2 Always populated
    Dim1 Measure3 Always populated
    Dim2 Measure3 Always null

    Bhawna -
    That made a difference, but it still needs some work. The IfNull() function picked up every value in the columns that I wanted to hide and changed them to zero. The conditional formatting that you suggested hid the content in those columns from the HTML. However, there ended up being several issues:
    1) IfNull() picked up other null values that happened to be in the resultset, so the conditional formatting was applied to more than intended. I could correct that by changing the data value in the physical database columns for the entire pivot table columns that I want hidden, but then I have to work around having bogus values in those intersections. Still, that is a possible workaround.
    2) The column headers for the columns that I want to disappear did not go away. When I applied CSS display:none, it shifts the pivot table cells to the left, so a lot of the data ends up under the wrong column headings.
    3) CSS display:none only hides the content from screen readers. When I view the pivot table on the dashboard and print it to a PDF, the data in the columns that I want to disappear are back.
    That still seems like it's a long ways from "suppress missing data" for the entire column. Thanks for your suggestion.
    Daniel

  • ADF Pivot Table

    Hi all,
    I am using JDeveloper 11.1.2.3.0
    Is it possible to create updatable pivot table in adf ?
    Expecting all of your valuable comments, links etc
    Thanks in advance
    gtg

    Yes you can edit cells in a pivot table. Check http://docs.oracle.com/cd/E24382_01/web.1112/e16181/dv_crosstab.htm#CHDCAFID (24.1.1.3 Editing Data Cells)
    Timo

  • Updating one table is updating ALL the materialized views

    We have a number of tables and also a number of materialized views that are interconnected. For some unexplained reason, when we update one table that should refresh one materialized view, all the materialized views are refreshed. It's causing massive bottlenecks on our system and we can't find the cause. Does anyone have any thoughts?

    "when we update one table that should refresh one materialized view, all the materialized views are refreshed" --If that table is used in the creation of all materialized views,then it will try to refresh all of them..(ON COMMIT REFRESH)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to Display a Detailed Grand Total Column in Pivot Table

    I have a pivot table that looks something like this:
    I would like to display the 'Grand Total' column at the end so that it is separated by year, like this:
    Is there a pivot table setting that would allow it to display this way? I've searched high and low but haven't found anything. I appreciate any help. Thanks!

    You can add a calculated item to the pivot table to display grand totals by year:
    1.  First, turn off grand totals for rows and columns (PIVOTTABLE TOOLS > DESIGN tab > Layout group > Grand Totals > Off for Rows and Columns)
    2.  Click on the Price List (Invoice) field in the pivot table (hidden above the
    Member field?).  You must click on the pivot table cell containing the field name for the entries "Member" and "Non-Member".
    3.  Add the calculated item (PIVOTTABLE TOOLS > ANALYZE tab > Calculations group > Fields, Items & Sets > Calculated item...
    4.  In the "Name:" box, type: Grand Totals
    5.  In the "Formula:" box, type: = Member + 'Non-Member'
    6.  Click the "Add" button, and then click "OK"

  • Table data not refreshing

    Hi ,
    I have created a data control which calls procedure to fetch data ...
    I drag and drop that on the page and create a table.
    This table also includes checkbox to update the some fields of the table.
    When i click on any specific row to update data,data gets updated properly.
    If i move to any other tab and again come back to that tab data get messed up (for example all the
    rows of one column is showing same data.
    ANy one has seen this issue in the past as I am not sure what leads to this behaviour?
    Thanks,
    shubhangi

    Hi,
    to persist data values, you don't call a setter on the table cell renderer but update the model. Soif you have input text component to render the table cell, then updating and submitting the data herin will update the ADF model, not the persisting model
    See sample #038 on http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html that shows a similar use case
    Frank

  • How to fix Action Link Issue in Table and Pivot Table when used Section

    My OBIEE Version: OBIEE 11.1.1.6.5
    Issue Description: Action links (Navigate to BI Content) doesn't work in PIVOT TABLE or TABLE object when used Section area (one or more columns in Section area).
    If you want to recreate this issue please follow next steps:
    1.     First of all you have to create one analyse with min 3 columns (for example Time.“Calendar date“, Product.Product, „Base Fact“. Revenue -> from Sample Sales Lite )
    2.     From column properties -> Set value Action Link Interaction on some column for example Product.Product (choose Navigate to BI Content -> any created BI report )
    3.     Click Results Tab choose Pivot Table and assigned one dimension column to Section area
    4.     Click preview icon
    5.     When you click on action link nothing happens
    6.     If you drug and drop column from Section Area to Excluded, Table or Pivot table Area then Action Link works perfectly
    How to fix this issue?
    I'll be grateful for any help!

    This is Bug:15922681 - ACTION LINK NAVIGATE TO BI CONTENT DOES NOT WORK WITH ATTRIBUTE IN SECTION
    Upgrade to 11.1.1.6.6 will fix this issue.

  • Data Source path in Pivot Table changes to absolute on its own

    Hello.
    I have a .XLSX file, that was created long time ago (I don't even know in which Office version, but definitely not 2013), and maybe even was a .XLS file at first.
    So it's a 4 MB file with 16 Sheets and 8 Pivot Tables.
    All of the Pivot Tables use other sheets from the same file as Data Source.
    Data Source for some of them look like this: 'Sheet3'!$A:$E
    Everything is fine when I save the file, and open it from saved file. 
    But as soon as I try to move the file elsewhere, or rename it, or email it - all Data Source paths change to something like this: '\Users\Sergii_Litnevskyi\Desktop\New folder\[FileName.xlsx]Sheet3'!$A:$E
    And it happens with all Pivot Tables. The problem is that it links to an old file path, where the file does not exist anymore. And it links to an external file, which is not what I want.
    If I Save As and select different path and filename - then it works fine. So it's a workaround for renaming and moving files, but not for sending them to other persons.
    I've read some threads, and people recommend disabling "Save external link values", but it does not help. It is already turned off in my office, but it keeps acting weird. 
    So what I need is: Save the file, close it, rename it, move it to other place, send it over email as attachment. And then I want to have the same Data Source path in my PivotTables as I had before I saved the file. How can I do it?
    My Office version: Microsoft Excel 2013 (15.0.4454.1503) MSO (15.0.4517.1005) 32-bit

    Hi,
    According to your description, I suppose the issue may be caused by some reason.
    Do you link the outside data source?
    I think if the file moves the file elsewhere, or renames, or email,
    data source paths can’t be change.
    But, your data source paths add the absolute path.
    Do you link the outside data source?
    I recommend you zip the file and send it as Email attachment.
    If the issue exists, you may save as it in a new name and test it in another computer.
    Regards,
    George Zhao
    TechNet Community Support
    I am pretty sure that I don't have any external links in the document.
    However, even if I did - why would it change Data Source path for all of the Pivot Tables, when I did not request it?
    I tried zipping it and sending to other person over email, but he got the file with changed data source paths.
    I can even record a short video to show what happens.
    Actually, I just did it. You can see the video here: http://screencast.com/t/qMBild3ck9b
    It is rather big - 23.8 MB.
    Let me explain what I showed there:
    I opened my original file. I showed that there are Pivot Tables, whose Data Sources are in the same file, on various other sheets.
    I showed this for all of the Pivot Tables in the document.
    I saved the file using Save As in a different folder and under a different name (TEST.xlsx).
    I then opened that saved file to show you that it is fine, and the Data Source path for one of the Pivot Tables is the same as it was in original file. It is the same for all of the other Pivot Tables.
    Then I closed, and simply renamed the file to TEST123.xlsx.
    Opened it, and first thing wrong - Security warning.
    Then I got ‘Cannot open PivotTable source file ….’ messages. And, as I showed, now all Data Source paths have been changed to full paths of the file, that was created by Save As (TEST.xlsx) from original file.

  • Excel 2010 Powerpivot workbook constanly crashing when editting pivot tables

    I have a quite large powerpivot work book that I store on dropbox.   If I want to add the same field twice I go tot  the normal pivot table field list and drop the field into the pivot table again.  This used to be fine.  I could
    then make it show the difference form previous period or similar.   Recently after doing a couple of these or changing the number format excel just crashes.   I have tried rewinding my workbook version back to older versions and still the
    same issue.  
    I tried just taking a simple single sheet of data and creating a new powerpivot model. i then dropped a couple of measures on to the pivot table and then the same measures again form the regular pivot table field list. I then tried to change on of these
    to show values as % column total and crashed. so the problem is excel not my workbook.
    I have run the repair through control panel and run sfc /scannow but problem persists. In event viewer the error shows as
    Faulting application name: EXCEL.EXE, version: 14.0.7109.5000, time stamp: 0x522a4035
    Faulting module name: EXCEL.EXE, version: 14.0.7109.5000, time stamp: 0x522a4035
    Exception code: 0xc0000005
    Fault offset: 0x00000000006d5a7b
    Faulting process id: 0xabc
    Faulting application start time: 0x01cf67968e9d437e
    Faulting application path: C:\Program Files\Microsoft Office\Office14\EXCEL.EXE
    Faulting module path: C:\Program Files\Microsoft Office\Office14\EXCEL.EXE
    Report Id: 371233aa-d38a-11e3-b47e-90b11c9a7548
    Windows error Reporting
    Fault bucket 135635980, type 4
    Event Name: APPCRASH
    Response: Not available
    Cab Id: 0
    Problem signature:
    P1: EXCEL.EXE
    P2: 14.0.7109.5000
    P3: 522a4035
    P4: EXCEL.EXE
    P5: 14.0.7109.5000
    P6: 522a4035
    P7: c0000005
    P8: 00000000006d5a7b
    P9:
    P10:
    Attached files:
    U:\Users\Mike\AppData\Local\Temp\416382.cvr
    U:\Users\Mike\Dropbox\In-n-Out\INO Data Model\INO_Data_Apr14.xlsx
    U:\Users\Mike\AppData\Local\Temp\CVRC1C8.tmp.cvr
    U:\Users\Mike\AppData\Local\Temp\WER6057.tmp.WERInternalMetadata.xml
    These files may be available here:
    U:\Users\Mike\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_EXCEL.EXE_6e3f938ed926058ac63c0bf295faed7891c5_150ec792
    Analysis symbol:
    Rechecking for solution: 0
    Report Id: 371233aa-d38a-11e3-b47e-90b11c9a7548
    Report Status: 0
    Really appreciate any help as its completely unpredictable and having to save my work every few minutes.
    Thanks
    Mike

    Hi,
    We can find the dump file after Excel crashed again. Please see the following steps:
    First enable app crash dump collection by copying following words into notepad, saving it as dump.reg and importing
    it:
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\localdumps\EXCEL.EXE]
    "DumpFolder"=hex(2):63,00,3a,00,5c,00,63,00,72,00,61,00,73,00,68,00,64,00,75,\
      00,6d,00,70,00,73,00,00,00
    "DumpCount"=dword:00000010
    "DumpType"=dword:00000001
    "CustomDumpFlags"=dword:00000000
    Then, open Excel
    to repro the issue. If crash issue appeared, please find the crashdump file under c:\.
    To further help you, please upload this file into Skydrive and shared the link here.
    Also, you can try to analyze dump by yourself if you would like to:
    How to analyze app crash dump file:
    http://blogs.technet.com/b/askperf/archive/2007/05/29/basic-debugging-of-an-application-crash.aspx
    Thanks
    George Zhao
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click "[email protected]"

Maybe you are looking for

  • How to reference a specific page of indesign file with xml

    Hi, I have a project that will produce many indesign files and what I want to do is use xml to build them. The main issue is that one of the source files will be in indesign. So what I need to find out is how do you specify attributes for page 2 of a

  • Non blocking socket: GUI hangs

    Hello, i have made a swing based GUI. It sends a request to the local server and the server keep sending response to it. Basically request is sent once, but response is in the form of stream. But my problem is that GUI hangs after getting the respons

  • Bridge does not see my external usb hard drive

    I have searched on this topic and the advice I've seen so far relates to when Bridge is set up to auto launch. That is not the case with me. I have Vista 32bit and CS3. I want to move files to it and make sure the keywords are ok. The drive is empty

  • Camera (focus) problem - help?

    Duplicate post, please see: Camera (focus) problem - help? Message was edited by: Admin Moderator

  • Code group in notification

    Dear all, i m using code group in pm notifications for malfunction codes. Is there any standard report i can get equipment malfunctions according to malfunction codes? I have checked iw28 , but seems not working. Thanks