You can pass a valid JSON as input and receive it in the script.
function main(workbook: ExcelScript.Workbook, file: YourFileInterface) {
console.log(file.someProperty);
}
interface YourFileInterface {
// define it
}
-- if for some reason you need to pass the file as a string, --
You can use JSON.parse()
to parse it back to JSON in the script.
This project might be helpful to watch:
https://github.com/sumurthy/officescripts-projects/tree/main/Excel%20and%20Teams%20Invite
Also, check out other projects that receive/uses JSON parameter as a string and parses in the script.
--
Could you also add more details around your scenario so that others can understand the question a little better? If you need further help, please add a comment.