Created
July 5, 2025 09:38
-
-
Save kuc-arc-f/11cf48c026a9dc2e84a18637ad2fa705 to your computer and use it in GitHub Desktop.
Golang Excel edit example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "github.com/xuri/excelize/v2" | |
func main() { | |
f := excelize.NewFile() | |
defer f.Close() | |
// 新規シート作成&セル書き込み | |
var shht_name = "Sheet1" | |
idx, _ := f.NewSheet(shht_name) | |
f.SetCellValue(shht_name, "A2", "こんにちは") | |
f.SetCellValue(shht_name, "B2", 123) | |
f.SetCellValue(shht_name, "A3", "hoge2") | |
f.SetCellValue(shht_name, "B3", 456) | |
f.SetActiveSheet(idx) | |
if err := f.SaveAs("sample.xlsx"); err != nil { | |
panic(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment