EXCEL file update sample with JAVA

//下記のURLでPOIのJARファイルをダウンロードする。 https://www.apache.org/dyn/closer.lua/poi/release/bin/poi-bin-3.17-20170915.tar.gz

import java.io.; import org.apache.poi.ss.usermodel.;

public class UpdateExcel { public static void main(String[] args) throws Exception { // Excel file File f = new File("C:\Book1.xlsx"); InputStream is = new FileInputStream(f); Workbook wb = WorkbookFactory.create(is); is.close();

// Sheet 1 Sheet s = wb.getSheetAt(0);

//第一行目 Row r0 = s.getRow(0); // A1 Cell A1 = r0.getCell(0); A1.setCellValue("W"); // A2 Cell A2 = r0.getCell(1); A2.setCellValue("K"); // A3 Cell A3 = r0.getCell(2); A3.setCellValue("O");

	OutputStream os = new FileOutputStream(f);
	wb.write(os);
}

}

Recommended Posts

EXCEL file update sample with JAVA
Let's operate Excel with Java! !!
Create an excel file with poi
[For beginners] Minimum sample to update RecyclerView with DiffUtils in Java
[Java] Handle Excel files with Apache POI
Sample to unzip gz file in Java
Java sample code 02
Java sample code 03
Selenium sample (Java)
Java GUI sample
java file creation
Java sample code 01
Sample to create PDF from Excel with Ruby
Let's write Java file input / output with NIO
Read a string in a PDF file with Java
[Java] Explanation of Strategy pattern (with sample code)
[Java] Convert and import file values with OpenCSV
[Java] File system operation
Install java with Homebrew
Java (jdk1.8 or later) file input / output sample program
Change seats with java
Install Java with Ansible
java (split source file)
Include image in jar file with java static method
Test the contents of an Excel file with JUnit
Comfortable download with JAVA
java core: chopped core file
[Java] Holiday judgment sample
Print Java Excel Worksheet
Replace text in Excel file autoshapes with Apache POI
Switch java with direnv
[Java] Get the file path in the folder with List
I tried OCR processing a PDF file with Java
[Java] logback slf4j sample
Let's scrape with Java! !!
Build Java with Wercker
Endian conversion with JAVA
How to decompile apk file to java source code with MAC
Activate Excel file A1 cell of each sheet in Java
Sample code to parse date and time with Java SimpleDateFormat
About the behavior when doing a file map with java
I tried OCR processing a PDF file with Java part2
[Java] Sample project for developing web applications with Spring Boot
csv file output with opencsv
Java multi-project creation with Gradle
Getting Started with Java Collection
Basic Authentication with Java 11 HttpClient
Let's experiment with Java inlining
Run batch with docker-compose with Java batch
[Template] MySQL connection with Java
Rewrite Java try-catch with Optional
Install Java 7 with Homebrew (cask)
[Java] JSON communication with jackson
Java update for Scala users
Digital signature sample code (JAVA)
Java to play with Function
Save Java PDF in Excel
Try DB connection with Java
Java merge & unmerge Excel cell
Java parallelization code sample collection
Enable Java EE with NetBeans 9