Skip to content

Commit

Permalink
Merge pull request #428 from OpenDataServices/sheet-name-length
Browse files Browse the repository at this point in the history
Remove restriction on CSV filename length
  • Loading branch information
odscjames authored Aug 29, 2023
2 parents dad9837 + 6cc26b0 commit 7d5d2f2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Changed

- Flatten & Create Template: Previously, CSV filenames were truncated to 31 characters, which is the maximum length of a sheet name in Excel.
Now allow CSV filenames of any length and only truncate sheet names when the output format is XLSX or ODS.
https://github.com/OpenDataServices/flatten-tool/pull/428

### Fixed

- flatten --sheet-prefix option does not work in ODS files https://github.com/OpenDataServices/flatten-tool/issues/430

## [0.22.0] - 2023-06-27

### Added
Expand Down
4 changes: 2 additions & 2 deletions flattentool/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def open(self):
def write_sheet(self, sheet_name, sheet):
sheet_header = list(sheet)
worksheet = self.workbook.create_sheet()
worksheet.title = self.sheet_prefix + sheet_name
worksheet.title = (self.sheet_prefix + sheet_name)[:31]
worksheet.append(sheet_header)
for sheet_line in sheet.lines:
line = []
Expand Down Expand Up @@ -131,7 +131,7 @@ def _make_cell(self, value):

def write_sheet(self, sheet_name, sheet):

worksheet = odf.table.Table(name=sheet_name)
worksheet = odf.table.Table(name=(self.sheet_prefix + sheet_name)[:31])
sheet_header = list(sheet)

header_row = odf.table.TableRow()
Expand Down
2 changes: 1 addition & 1 deletion flattentool/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def make_sub_sheet_name(
x[:truncation_length] for x in parent_path.split(path_separator) if x != "0"
)
+ property_name
)[:31]
)


class TitleLookup(UserDict):
Expand Down

0 comments on commit 7d5d2f2

Please sign in to comment.