Go可以使用第三方库如excelize或go-xlsx来读取Excel文件。以下是使用excelize库的示例代码: ``` import ( "fmt" "github.com/360EntSecGroup-Skylar/excelize" ) func main() { f, err := excelize.OpenFile("Book1.xlsx") if err != nil { fmt.Println(err) return } // Get all the rows in the Sheet1. rows, err := f.GetRows("Sheet1") for _, row := range rows { for _, colCell := range row { fmt.Print(colCell, "\t") } fmt.Println() } } ``` 该代码将打开名为“Book1.xlsx”的Excel文件,并在Sheet1中遍历所有行和列。