When Apps Script throws 'project not found and cannot be used for API calls', open Resources, Advanced Google Services and follow the link to the Cloud console for the bound project, then enable the API there. Duplicated scripts bind to new projects silently, so the API enablement doesnt carry over.

Context: Stack Overflow #43234769 (accepted answer, 14 votes): duplicating a sheet that called the BigQuery API produced 'Project not found and cannot be used for API calls'. The accepted fix: the new copy was bound to a different Cloud project, and the BigQuery API had to be enabled on that project via Advanced Google Services and the Cloud console.