Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Erasing a graph sent to Excel using -putexcel-

    Dear all,

    I have sent a graph (exported as PNG) to Excel using -putexcel-. Is there a way to erase it from Stata, that is, without opening the Excel document manually and erasing the graph?

    Best,
    Ivica Rubil
    // ivica_rubil //

  • #2
    you don't say whether you are trying to erase the entire file or just part of the file; if the entire file, see
    Code:
    h erase
    since I don't have access to excel, I can't answer the other option if that is what you want

    Comment


    • #3
      I'm trying to erase just the graph, located in a specific cell of a specific sheet.
      // ivica_rubil //

      Comment


      • #4
        Interestingly I don't see such a function documented either in Mata's Excel class (-xl()-) nor in -putexcel- which leads me to think that functionality doesn't exist. The only workaround I can think of would be to regenerate the Excel sheet that contains that image, making sure to -replace- it so that the entire contents of the old sheet are erased.

        Comment


        • #5
          Leonardo Guizzetti, is it really possible to replace (rather than modify) just one sheet within a document? If I understand -putexcel- correctly, you can only replace the whole document. Right?
          Last edited by Ivica Rubil; 20 May 2025, 06:52.
          // ivica_rubil //

          Comment


          • #6
            You may modify the workbook, but replace a single sheet. I believe you also need -open- or -modify- as an additional option for putexcel as well.

            Code:
            putexcel set filename , sheet(sheetname, replace)

            Comment

            Working...
            X