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

Add an option to read Excel cell values as a String regardless of their content type #745

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

koperagen
Copy link
Collaborator

fixes #669
Once again based on user feedback, and also was mentioned previously

@koperagen koperagen self-assigned this Jun 19, 2024
@koperagen koperagen added the enhancement New feature or request label Jun 19, 2024
@koperagen koperagen added this to the 0.14.0 milestone Jun 19, 2024
@@ -83,6 +84,9 @@ private fun setWorkbookTempDirectory() {
/**
* @param sheetName sheet to read. By default, the first sheet in the document
* @param columns comma separated list of Excel column letters and column ranges (e.g. “A:E” or “A,C,E:F”)
* @param formattingOptions range of columns to read as String regardless of a cell type.
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not just that right? You can format a range of columns as string using different options as defined by a DataFormatter. The description should probably reflect this.

If this argument was just to format columns as string, the argument should be colRangeAsString or better, mirror the colTypes argument from CSV.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed the parameter for some overloads to StringColumns class and provided see also where it's still FormattingOptions

@koperagen koperagen force-pushed the excel-string-value branch 2 times, most recently from 0703ed9 to 2e97bd2 Compare June 20, 2024 13:14
@@ -83,6 +84,8 @@ private fun setWorkbookTempDirectory() {
/**
* @param sheetName sheet to read. By default, the first sheet in the document
* @param columns comma separated list of Excel column letters and column ranges (e.g. “A:E” or “A,C,E:F”)
* @param stringColumns range of columns to read as String regardless of a cell type.
* For example, by default numeric cell with value "3" will be parsed as Double with value being 3.0. With this option, it will be simply "3"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd surround types with [] to make them clickable :). *their type or *a cell's type

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What types? String and Double?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, that's what I do to all types across the kdocs :) I think it's nice for interactivity and consistency.

}

/**
* @param sheet sheet to read.
* @param columns comma separated list of Excel column letters and column ranges (e.g. “A:E” or “A,C,E:F”)
* @param formattingOptions range of columns to read as String regardless of a cell type.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably say "as [String], formatted by the given [FormattingOptions]" or something like that. Otherwise it's not clear what the difference is by the overload with stringColumns and this one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think "see also" below and the fact that type is different is enough

@koperagen koperagen merged commit 2e3acfe into master Jun 20, 2024
5 checks passed
@Jolanrensen Jolanrensen deleted the excel-string-value branch July 23, 2024 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support an option to get formatCellValue in readExcel
2 participants