1

I have 2 Excel Workbooks, A and B.

Workbook A.xls has 2 worksheets, Sheet1 and Sheet2. Workbook B.xls also has Sheet1 and Sheet2.

Without opening the workbooks, I would like to delete Sheet2 in A.xls, and replace it with Sheet2 from B.xls. It is something that I need to do quite a lot, hence the need to cut out the opening of the workbooks!

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
ZakS
  • 285
  • 1
  • 4
  • 13
  • 1
    You can do that by writing a Java program (or any JVM language) using the Apache Poi library. Writing the code for you is beyond the scope of StackExchange, but certainly make an attempt and then ask specific questions. – Emmanuel Rosa Apr 09 '19 at 13:01
  • I can give that a try. Just so I confirm I have the general direction right, you are saying I should create a file, and then call it from the shell? – ZakS Apr 09 '19 at 13:10
  • https://poi.apache.org/components/spreadsheet/quick-guide.html -- You can use POI to either create a Workbook from scratch, or use a template as an input to modify in the steps manner you need. – Mark Stewart Apr 09 '19 at 13:27
  • Well, if you write the program in Java then you need to compile it first. Only after compiling the program can you run it with the Java virtual machine from the shell. If you write the program in Groovy, for example, then you can use the Groovy shell as the interpreter for your program; instead of a shell like BASH or tcsh. Hence, the program would act like a shell script, even though it still gets compiled first. – Emmanuel Rosa Apr 10 '19 at 12:09

0 Answers0