37 lines
900 B
Go
37 lines
900 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/shopspring/decimal"
|
|
"os/exec"
|
|
"strconv"
|
|
)
|
|
|
|
func NumToRow(str string) (res string) {
|
|
strDecimal, _ := decimal.NewFromString(str)
|
|
for {
|
|
left := strDecimal.Div(decimal.NewFromInt(26)).RoundDown(0)
|
|
right := strDecimal.Mod(decimal.NewFromInt(26)).RoundDown(0)
|
|
if right.IsZero() && !left.IsZero() {
|
|
left = left.Sub(decimal.NewFromInt(1))
|
|
right = decimal.NewFromInt(26)
|
|
}
|
|
rightInt, _ := strconv.Atoi(right.String())
|
|
res = fmt.Sprintf("%c", rightInt+64) + res
|
|
if left.Equal(decimal.NewFromInt(0)) {
|
|
break
|
|
}
|
|
strDecimal = left
|
|
}
|
|
return res
|
|
}
|
|
|
|
func ToXlsx(fileType, oldFilePath string) {
|
|
c := exec.Command("python3", "./toXlsx.py", fileType, oldFilePath) // /usr/local/bin/python3.11
|
|
//c := exec.Command("nohup", "./toXlsx", fileType, oldFilePath, newFilePath)
|
|
_, err := c.CombinedOutput()
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
}
|