Highlighted

SpreadsheetCreateSheet - check if sheet already exists?

LEGEND ,
Jul 19, 2017

Copy link to clipboard

Copied

Hello, all,

I'm working with SpreadsheetNew and SpreadsheetCreateSheet, populating from a query object.

I've experienced something that I've never seen, before.  If you have a Spreadsheet object and try to add a sheet to it using a name that already exists, CF will abort.  I finally got it to email the reason to me.  "The workbook already contains a sheet of this name."

I am sorting the data on the column (FQDN) that I am using to name the sheets with.  I'm removing "http://" and "https://" from the FQDN and using "www.example.com" as the sheet names.

However, I did not expect for there to be "http://www.example.com" AND "https://www.example.com", so when CF creates "www.example.com", populates the sheet, then tries to create "www.example.com", again, it just stops.

I am not seeing any CF Spreadsheet(blahblahblah) commands that will check to see if a sheet already exists.

I will try to modify the query so that both standard and encrypted FQDNs fall into the same group, but just in case.. can anyone think of a way to check if a particular sheet name already exists within a Spreadsheet object??

V/r,

^ _ ^

Well, I did kind of find an answer to my question.  You can use SpreadsheetInfo(obj) to get information about the spreadsheet object, including a column called "SHEETNAMES".  It's a comma-delimited list of the names of currently existing spreadsheets.  I will iterate through that and just make that the active sheet instead of creating it if the name already exists.

V/r,

^ _ ^

Views

342

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

SpreadsheetCreateSheet - check if sheet already exists?

LEGEND ,
Jul 19, 2017

Copy link to clipboard

Copied

Hello, all,

I'm working with SpreadsheetNew and SpreadsheetCreateSheet, populating from a query object.

I've experienced something that I've never seen, before.  If you have a Spreadsheet object and try to add a sheet to it using a name that already exists, CF will abort.  I finally got it to email the reason to me.  "The workbook already contains a sheet of this name."

I am sorting the data on the column (FQDN) that I am using to name the sheets with.  I'm removing "http://" and "https://" from the FQDN and using "www.example.com" as the sheet names.

However, I did not expect for there to be "http://www.example.com" AND "https://www.example.com", so when CF creates "www.example.com", populates the sheet, then tries to create "www.example.com", again, it just stops.

I am not seeing any CF Spreadsheet(blahblahblah) commands that will check to see if a sheet already exists.

I will try to modify the query so that both standard and encrypted FQDNs fall into the same group, but just in case.. can anyone think of a way to check if a particular sheet name already exists within a Spreadsheet object??

V/r,

^ _ ^

Well, I did kind of find an answer to my question.  You can use SpreadsheetInfo(obj) to get information about the spreadsheet object, including a column called "SHEETNAMES".  It's a comma-delimited list of the names of currently existing spreadsheets.  I will iterate through that and just make that the active sheet instead of creating it if the name already exists.

V/r,

^ _ ^

Views

343

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 19, 2017 0
LEGEND ,
Jul 19, 2017

Copy link to clipboard

Copied

Well, I did kind of find an answer to my question.  You can use SpreadsheetInfo(obj) to get information about the spreadsheet object, including a column called "SHEETNAMES".  It's a comma-delimited list of the names of currently existing spreadsheets.  I will iterate through that and just make that the active sheet instead of creating it if the name already exists.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 19, 2017 0