Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel export issue #6939

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Excel export issue #6939

wants to merge 2 commits into from

Conversation

NamanMahor
Copy link
Contributor

@NamanMahor NamanMahor commented Mar 20, 2025

when data is exported to the Excel XLSX format from Pivot table views in Rill, two issues arise:

  1. Time dimension fields appears as strings such as 2025-01-23T00:00:00Z

Actually it occurs when we export to csv so need fix in csv export(confirm from file share by Customer).

  1. Other values appear with quotation marks surrounding them

This was issue in both excel csv and parquet export. This issue was happening when we convert to parquet file in case of pivot table.

Closed #6765

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@NamanMahor NamanMahor requested a review from k-anshul March 20, 2025 13:45
case string:
s = tval
case time.Time:
s = tval.In(time.UTC).Format(time.DateTime) // this format is also auto convert to datetime in excel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this format is auto converted to datetime in excel

@@ -334,12 +342,15 @@ func writeParquet(res *drivers.Result, fw io.Writer) error {
return err
}
recordBuilder.Field(i).(*array.TimestampBuilder).Append(tmp)
case runtimev1.Type_CODE_STRING, runtimev1.Type_CODE_INTERVAL, runtimev1.Type_CODE_DATE, runtimev1.Type_CODE_ARRAY, runtimev1.Type_CODE_STRUCT, runtimev1.Type_CODE_MAP, runtimev1.Type_CODE_JSON, runtimev1.Type_CODE_UUID:
case runtimev1.Type_CODE_STRING, runtimev1.Type_CODE_DATE:
v, _ := v.(string)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datetype date will not be scanned to a string.

h, err := drivers.Open("clickhouse", "default", map[string]any{"dsn": "clickhouse://localhost:9000"}, storage.MustNew(os.TempDir(), nil), activity.NewNoopClient(), zap.NewNop())
	if err != nil {
		panic(err)
	}

	olap, _ := h.AsOLAP("default")

	result, err := olap.Execute(context.Background(), &drivers.Statement{
		Query: "SELECT '2024-01-01'::Date32",
	})
	if err != nil {
		panic(err)
	}
	var t any
	for result.Next() {
		if err := result.Scan(&t); err != nil {
			panic(err)
		}
		// panic: interface conversion: interface {} is time.Time, not string
		println(t.(string))
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improve formatting of Excel (XLSX) exports in Explore dashboards
2 participants