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

Rename/Remove default sheet name as Sheet1 #1143

Closed
sbhardwaj8717 opened this issue Feb 9, 2022 · 7 comments
Closed

Rename/Remove default sheet name as Sheet1 #1143

sbhardwaj8717 opened this issue Feb 9, 2022 · 7 comments

Comments

@sbhardwaj8717
Copy link

sbhardwaj8717 commented Feb 9, 2022

Description
I am trying to looking for some method so that I can rename the default sheet name or I can remove the default sheet named as Sheet1

go version go1.17.6 darwin/amd64

Describe the results you received:
image

@xuri
Copy link
Member

xuri commented Feb 9, 2022

Please rename sheet name with SetSheetName.

@microo8
Copy link

microo8 commented Feb 9, 2022

And how it can be deleted? I'm creating the sheets in a loop and this is just there. wb.DeleteSheet("Sheet1") doesn't work.
EDIT: ok so it works if there some sheets. So i'll do it at the end, before writing to file.

@sbhardwaj8717
Copy link
Author

sbhardwaj8717 commented Feb 9, 2022

Thanks @xuri this works fine for me ;)

@sbhardwaj8717
Copy link
Author

@xuri I am stuck in resizing the cell width according to the cell data. Is there any way to may it possible to resize the cell size automatically?

@xuri
Copy link
Member

xuri commented Mar 9, 2022

This library support setting the text font size fit cell by setting the ShrinkToFit style for cells, but doesn't support set columns width or rows height to fit the cell, also reference issue #92.

@esodell
Copy link

esodell commented Jul 14, 2022

I was also wondering about deleting Sheet 1 after creating other named sheets in a loop. Found out you can with DeleteSheet() but only after you've added other sheets, so just append the delete after your loop

@xuri
Copy link
Member

xuri commented Jul 15, 2022

Hi @esodell, as the documentation of the DeleteSheet function says: it will be invalid when only one worksheet is left. This behavior was similar to Excel.

@xuri xuri closed this as completed Jul 15, 2022
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

No branches or pull requests

4 participants