20vues (au cours des 30derniers jours)
Afficher commentaires plus anciens
Kaden Shearer le 13 Mai 2019
-
-
Lien
Utiliser le lien direct vers cette question
https://fr.mathworks.com/matlabcentral/answers/461877-how-to-delete-default-excel-sheets-when-using-writetable-function-mac
Commenté: dscharf le 22 Juin 2024 à 0:04
Réponse acceptée: Walter Roberson
Ouvrir dans MATLAB Online
When using the writetable function to add several different sheets, excel generates default (blank) excel sheets at the beginning of the document. I currently am working off a mac computer and thus cannot use the actxserver solutions described in other posts.
writetable(T,filename,'sheet','sheet_name');
2commentaires Afficher AucuneMasquer Aucune
Afficher AucuneMasquer Aucune
Veronique Lago le 11 Sep 2019
Utiliser le lien direct vers ce commentaire
https://fr.mathworks.com/matlabcentral/answers/461877-how-to-delete-default-excel-sheets-when-using-writetable-function-mac#comment_744679
I found a way around it. Create a template Excel sheet with the sheets you want and the name you want, but empty sheets. In your code, before using writetable, use copyfile to copy your template with the name of the file you want to create. Then, when you use writetable, it opens the sheets with sheets with the name you give from this template and fills it in.
dscharf le 22 Juin 2024 à 0:04
Utiliser le lien direct vers ce commentaire
https://fr.mathworks.com/matlabcentral/answers/461877-how-to-delete-default-excel-sheets-when-using-writetable-function-mac#comment_3193011
@Veronique Lago Your approach worked for me - thank you thank you!
Connectez-vous pour commenter.
Connectez-vous pour répondre à cette question.
Réponse acceptée
Walter Roberson le 14 Mai 2019
Mathworks does not offer any way to do this.
This question was recently explored in the context of someone who was providing sheet names, and was ending up with 3 extra sheets with default names. Someone (dbp I think it was) indicated that when Excel is asked to create a workbook, that it automatically adds the first sheet, and so for compatibility with Excel the first useless sheet is generated. We did not, however, see any good reason for the code to automatically generate sheet2 and sheet3.
2commentaires Afficher AucuneMasquer Aucune
Afficher AucuneMasquer Aucune
Kaden Shearer le 14 Mai 2019
Utiliser le lien direct vers ce commentaire
https://fr.mathworks.com/matlabcentral/answers/461877-how-to-delete-default-excel-sheets-when-using-writetable-function-mac#comment_704823
Too bad, thank you anyways for the information.
Sean de Wolski le 16 Sep 2019
Utiliser le lien direct vers ce commentaire
https://fr.mathworks.com/matlabcentral/answers/461877-how-to-delete-default-excel-sheets-when-using-writetable-function-mac#comment_746502
In R2019b, this is now possible.
Connectez-vous pour commenter.
Plus de réponses (1)
Sean de Wolski le 16 Sep 2019
Ouvrir dans MATLAB Online
Starting in R2019b, specifying the sheet will cause "Sheet"+(1:3) to not be created. This is a new feature of 19b.
writetable(t, 'foo.xlsx', 'Sheet', 'T')
Will only have a sheet, "T".
2commentaires Afficher AucuneMasquer Aucune
Afficher AucuneMasquer Aucune
Lucie S. le 25 Mar 2020
Utiliser le lien direct vers ce commentaire
https://fr.mathworks.com/matlabcentral/answers/461877-how-to-delete-default-excel-sheets-when-using-writetable-function-mac#comment_815099
Modifié(e): Lucie S. le 25 Mar 2020
As I see there are some changes in R2019b with the Writetable fonction, I take the opurtunity to ask you a question. I have an issue starting with that new Matlab version. I use writetable to copy a table in a template excel file which has different background colors. Before R2019b, I was keeping colors in the template file after using the function. Now I get some white background columns in my template file after using the function. Any idea how to avoid this? I have different types of data that I can't change in my table. The cell data type might be the one used when I get those white background (I will have to check in detail, this is a very complex program).
Sean de Wolski le 25 Mar 2020
Utiliser le lien direct vers ce commentaire
https://fr.mathworks.com/matlabcentral/answers/461877-how-to-delete-default-excel-sheets-when-using-writetable-function-mac#comment_815179
Lucie, please ask this as a new question!
Connectez-vous pour commenter.
Connectez-vous pour répondre à cette question.
Voir également
Catégories
MATLABData Import and AnalysisData Import and ExportStandard File FormatsSpreadsheets
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Tags
- writetable
- excel
- sheets
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Une erreur s'est produite
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asie-Pacifique
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Contactez votre bureau local