MCPcopy Create free account
hub / github.com/bytebase/bytebase / ExcelColumnName

Function ExcelColumnName

backend/component/export/xlsx.go:70–85  ·  view source on GitHub ↗

ExcelColumnName converts a column index to Excel column name (A, B, ..., Z, AA, AB, ..., ZZZ).

(index int)

Source from the content-addressed store, hash-verified

68
69// ExcelColumnName converts a column index to Excel column name (A, B, ..., Z, AA, AB, ..., ZZZ).
70func ExcelColumnName(index int) (string, error) {
71 if index >= ExcelMaxColumn {
72 return "", errors.Errorf("index cannot be greater than %v (column ZZZ)", ExcelMaxColumn)
73 }
74
75 var s string
76 for {
77 remain := index % 26
78 s = string(excelLetters[remain]) + s
79 index = index/26 - 1
80 if index < 0 {
81 break
82 }
83 }
84 return s, nil
85}
86
87func convertValueToStringInXLSX(value *v1pb.RowValue) string {
88 if value == nil || value.Kind == nil {

Callers 2

XLSXFunction · 0.85
TestGetExcelColumnNameFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by 1

TestGetExcelColumnNameFunction · 0.68