Intend to add Worksheet in a Workbook (csv file)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-04-22 08:19 AM
Hello,
This could be easy and simple to most of you and need help. I have an existing csv file with one worksheet. I want to add another worksheet with just one row but it ended up overwriting the existing worksheet. Below is what I did:
1) define new collection and add fields --> named "Payinfo"
2) use MS Excel VBO - Open Workbook
3) use MS Excel VBO - Create Worksheet --> to create another sheet named "Payment_info"
4) use calculation to assign value and Store in the collection field example: Payinfo.PaymentID
5) use calculation stage to assign value to CelRef example: "A"&[ctr] note that ctr equals to 1
6) use MS Excel VBO - Write Collection
7) use MS Excel VBO - Close Workbook
😎 use MS Excel VBO - Close Instance
After the Close instance stage , the Payment_info worksheet overwrite the existing worksheet. I need both worksheet (the current and new one) . Am I missing something? please help me why is it overwriting the existing worksheet?
Appreciate it.
------------------------------
Marilyn Gagarin
Senior Programmer/Analyst
United Rental, Inc.
America/New_York
------------------------------
This could be easy and simple to most of you and need help. I have an existing csv file with one worksheet. I want to add another worksheet with just one row but it ended up overwriting the existing worksheet. Below is what I did:
1) define new collection and add fields --> named "Payinfo"
2) use MS Excel VBO - Open Workbook
3) use MS Excel VBO - Create Worksheet --> to create another sheet named "Payment_info"
4) use calculation to assign value and Store in the collection field example: Payinfo.PaymentID
5) use calculation stage to assign value to CelRef example: "A"&[ctr] note that ctr equals to 1
6) use MS Excel VBO - Write Collection
😎 use MS Excel VBO - Close Instance
After the Close instance stage , the Payment_info worksheet overwrite the existing worksheet. I need both worksheet (the current and new one) . Am I missing something? please help me why is it overwriting the existing worksheet?
Appreciate it.
------------------------------
Marilyn Gagarin
Senior Programmer/Analyst
United Rental, Inc.
America/New_York
------------------------------
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-04-22 03:00 PM
@mgagarin1
A CSV file is a flat-file which can only contain one set of data at a time. When Excel imports it, it puts it into an Excel worksheet that is part of an Excel workbook. The problem you are experiencing is that by saving the workbook back to the CSV format, Excel can only export the data on the first worksheet back into the CSV flat-file.
------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------
A CSV file is a flat-file which can only contain one set of data at a time. When Excel imports it, it puts it into an Excel worksheet that is part of an Excel workbook. The problem you are experiencing is that by saving the workbook back to the CSV format, Excel can only export the data on the first worksheet back into the CSV flat-file.
------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------
Micheal Charron
RBC
Toronto, Ontario
Canada
RBC
Toronto, Ontario
Canada
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-04-22 05:02 AM
Hi Micheal,
I was thinking that csv is like xlsx when it comes to worksheets. I got it now and I am all set. Thank you!
------------------------------
Marilyn Gagarin
Senior Programmer/Analyst
United Rental, Inc.
America/New_York
------------------------------
I was thinking that csv is like xlsx when it comes to worksheets. I got it now and I am all set. Thank you!
------------------------------
Marilyn Gagarin
Senior Programmer/Analyst
United Rental, Inc.
America/New_York
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-04-22 01:49 PM
Hi Marilyn,
We have a similar situation where we need to save worksheet data when Office is down (again...) with a license issue. In such cases the process diverts to creating CSV files, one for each worksheet, and adding the name of the intended worksheet to the CSV file name.
------------------------------
Happy coding!
Paul
Sweden
------------------------------
We have a similar situation where we need to save worksheet data when Office is down (again...) with a license issue. In such cases the process diverts to creating CSV files, one for each worksheet, and adding the name of the intended worksheet to the CSV file name.
------------------------------
Happy coding!
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)
Paul, Sweden
(By all means, do not mark this as the best answer!)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-04-22 08:09 PM
I like the idea adding worksheet name in csv filename. Thanks Paul.
------------------------------
Marilyn Gagarin
Senior Programmer/Analyst
United Rental, Inc.
America/New_York
------------------------------
------------------------------
Marilyn Gagarin
Senior Programmer/Analyst
United Rental, Inc.
America/New_York
------------------------------
